Use Flickwerk for loading patches in solidus_promotions and solidus_legacy_promotions#6049
Merged
tvdeyen merged 4 commits intosolidusio:mainfrom Feb 18, 2025
Merged
Conversation
adammathys
approved these changes
Jan 3, 2025
cd8ae9f to
f8b3503
Compare
tvdeyen
reviewed
Jan 3, 2025
mamhoff
commented
Jan 3, 2025
Member
|
Waits until #6056 got merged |
f8b3503 to
955e210
Compare
tvdeyen
approved these changes
Jan 9, 2025
de7f1c7 to
230478e
Compare
230478e to
a37fc31
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #6049 +/- ##
==========================================
+ Coverage 88.72% 88.81% +0.09%
==========================================
Files 834 835 +1
Lines 18139 18146 +7
==========================================
+ Hits 16093 16116 +23
+ Misses 2046 2030 -16 ☔ View full report in Codecov by Sentry. |
jarednorman
approved these changes
Jan 22, 2025
a37fc31 to
ade272b
Compare
7b84a40 to
2ed9d80
Compare
Otherwise, patching it does not work.
When configuring Flickwerk, we need a way to get at class names without constantizing (i.e. loading) those classes. This adds some specs for the `class_name_attribute` class method on Spree::Preferences::Configuration, and generates a new getter that has `_name` attached to the method to get just the string name.
This stops us from loading line item, order, adjustment, shipment, shipping rate, and the order recalculator on app startup.
This should stop us from loading order, line items, adjustment, calculators, the order updater, product, and shipment on app startup.
2ed9d80 to
6cb5d59
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Uses the Flickwerk gem to load patches in the solidus_promotions and solidus_legacy_promotions gems.
This allows us to defer loading of patches to when the classes being patched are autoloaded, rather than loading them in a
config.to_prepareblock.The commit history should explain the few things I had to add here. Namely, I had to add a getter to
Spree::Preferences::Configurationfor the class names of configurable classes in order to configure Flickwerk to be able to understand patches likeSpree::Config.order_recalculator_class.prepend self.Checklist
Check out our PR guidelines for more details.
The following are mandatory for all PRs:
The following are not always needed: