Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Solidus Deprecation Warning for MenuItem: Passing sections to MenuItem is deprecated. Please pass a label instead. #294

Open
erwin opened this issue Jan 18, 2024 · 0 comments · May be fixed by #300
Labels
bug Describes or fixes a bug.

Comments

@erwin
Copy link

erwin commented Jan 18, 2024

When starting Solidus with the solidus_subscriptions gem, we get a deprecation warning:

DEPRECATION WARNING: Passing sections to Spree::BackendConfiguration::MenuItem is deprecated. Please pass a label instead. (called from new at /home/erwin/.rbenv/versions/3.1.4/lib/ruby/gems/3.1.0/bundler/gems/solidus_subscriptions-1149f416b1be/lib/solidus_subscriptions/engine.rb:43)
DEPRECATION WARNING: Passing icon to Spree::BackendConfiguration::MenuItem is deprecated. Please use the keyword argument instead. (called from new at /home/erwin/.rbenv/versions/3.1.4/lib/ruby/gems/3.1.0/bundler/gems/solidus_subscriptions-1149f416b1be/lib/solidus_subscriptions/engine.rb:43)

Looks like this comes from:

config.menu_items << config.class::MenuItem.new(

Per the Solidus documentation, seems the format has changed to:

https://guides.solidus.io/customization/customizing-the-backend#adding-new-menu-items

  # ...
  config.menu_items << config.class::MenuItem.new(
    label: :rejected_orders,
    icon: 'ban',
    url: '/admin/orders?q[rejected_eq]=true' )

Solidus Version:
4.2.3

Additional context
Not a major issue. Just would be a better experience for new developers and existing developers to update this and clear the warning on rails server startup.

Fix
I think if you just change the structure to the following, it should work and clear the deprecation notice:

        config.menu_items << config.class::MenuItem.new(
          label: :subscriptions,
          icon: 'repeat',
          url: :admin_subscriptions_path,
          condition: ->{ can?(:admin, SolidusSubscriptions::Subscription) },
          match_path: '/subscriptions'
        )
@erwin erwin added the bug Describes or fixes a bug. label Jan 18, 2024
erwin added a commit to erwin/solidus_subscriptions that referenced this issue Jun 15, 2024
@erwin erwin linked a pull request Jun 15, 2024 that will close this issue
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Describes or fixes a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant