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

Make Controller Helpers autoloadable #6062

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

mamhoff
Copy link
Contributor

@mamhoff mamhoff commented Jan 9, 2025

There's no real good reason to keep these files in lib and require them on app startup. Let's put them in app/ and let Zeitwerk handle their loading.

@mamhoff mamhoff requested a review from a team as a code owner January 9, 2025 09:39
@github-actions github-actions bot added the changelog:solidus_core Changes to the solidus_core gem label Jan 9, 2025
@mamhoff mamhoff force-pushed the autoloadable-controller-helpers branch from ea50bb9 to 1eced48 Compare January 9, 2025 09:48
@kennyadsl
Copy link
Member

I think the reason to have them in lib is to being easily loadable by host applications and extensions. Can we do the same now?

Copy link

codecov bot commented Jan 9, 2025

Codecov Report

Attention: Patch coverage is 80.00000% with 1 line in your changes missing coverage. Please review.

Project coverage is 89.39%. Comparing base (85a0a25) to head (39e835b).

Files with missing lines Patch % Lines
...pp/helpers/spree/core/controller_helpers/common.rb 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6062      +/-   ##
==========================================
- Coverage   92.52%   89.39%   -3.13%     
==========================================
  Files         385      791     +406     
  Lines        8400    18274    +9874     
==========================================
+ Hits         7772    16336    +8564     
- Misses        628     1938    +1310     

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

@mamhoff
Copy link
Contributor Author

mamhoff commented Jan 9, 2025

Yes, they have the same loading characteristics as e.g. Spree::Order - available from anywhere simply by invoking the constant names.

@kennyadsl
Copy link
Member

Right, we just don't need any require before using it now. What about keeping the files and print a warning telling people that they can remove the require now? I'm afraid this might break all stores requiring the lib files.

@mamhoff mamhoff force-pushed the autoloadable-controller-helpers branch from 39e835b to 38e9282 Compare January 9, 2025 12:42
@mamhoff
Copy link
Contributor Author

mamhoff commented Jan 9, 2025

Right, we just don't need any require before using it now. What about keeping the files and print a warning telling people that they can remove the require now? I'm afraid this might break all stores requiring the lib files.

Good catch. I've re-added the files in lib with just a deprecation warning. There's even a test documenting what happens.

There's no real good reason to keep these files in lib and require them
on app startup. Let's put them in app/ and let Zeitwerk handle their
loading.
These are easy enough.
@mamhoff mamhoff force-pushed the autoloadable-controller-helpers branch from 38e9282 to cf07217 Compare January 9, 2025 13:25
Copy link
Member

@tvdeyen tvdeyen left a comment

Choose a reason for hiding this comment

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

Thanks.

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.

3 participants