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

Performance: Remove includes from Spree::Variant#options_text #5867

Merged
merged 1 commit into from
Oct 18, 2024

Conversation

mamhoff
Copy link
Contributor

@mamhoff mamhoff commented Oct 9, 2024

While it seems like a good idea to include the option types in this instance method on Spree::Variant, it's actually not. This method is likely used in a view context, where the controller will have preloaded the option types and option values already - running option_values.includes(:option_type) here will then generate a query even though things are preloaded already.

The following are mandatory for all PRs:

While it seems like a good idea to include the option types in this
instance method on Spree::Variant, it's actually not. This method is
likely used in a view context, where the controller will have preloaded
the option types and option values already - running
`option_values.includes(:option_type)` here will then generate a query
even though things are preloaded already.
@mamhoff mamhoff requested a review from a team as a code owner October 9, 2024 06:45
@github-actions github-actions bot added the changelog:solidus_core Changes to the solidus_core gem label Oct 9, 2024
Copy link

codecov bot commented Oct 9, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.24%. Comparing base (3a92a45) to head (3cb9d79).
Report is 27 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #5867   +/-   ##
=======================================
  Coverage   89.24%   89.24%           
=======================================
  Files         754      754           
  Lines       17533    17533           
=======================================
  Hits        15647    15647           
  Misses       1886     1886           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@kennyadsl kennyadsl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left a couple of non-blocking comments, thanks Martin!

core/app/models/spree/variant.rb Show resolved Hide resolved
@tvdeyen tvdeyen added this to the 4.4 milestone Oct 18, 2024
@kennyadsl kennyadsl merged commit 01a15b5 into solidusio:main Oct 18, 2024
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog:solidus_core Changes to the solidus_core gem
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants