-
-
Notifications
You must be signed in to change notification settings - Fork 23
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
Re-enable flickwerk-style patches #94
Merged
Merged
Conversation
This file contains 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
f64be5e
to
6786a9b
Compare
fd7e030
to
76333db
Compare
jarednorman
approved these changes
Jan 22, 2025
c37437e
to
3c30516
Compare
Rather than iterating over all patches, we can tell Flickwerk upfront what to replace. Update Flickwerk dependency to 0.3.4 This should not mess with load order the way 0.2 did. Add patch paths in `lib` to autoload paths. Patches should be autoloaded, and this will do it. Load User class aliases in app reloader prep callback We need to delay setting the alias of `Spree.user_class` to the configured `Spree.user_class_name` to just before loading the patches, otherwise we end up with the wrong user class name in some cases.
We want our initializers to be calles something like `solidus_reviews_backend_paths` rather than `Solidus::Reviews_backend_paths`, because the latter looks odd.
3c30516
to
e425951
Compare
Solidus versions < 4.5 `require` some of their application code. This leads to hard-to-debug problems with Flickwerk patches. What this does is eager-load all the patches in a `to_prepare` hook by constantizing them.
e425951
to
eec7710
Compare
tvdeyen
approved these changes
Jan 24, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice work. We tested it in several extensions. This is ready to go 🎉
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
We found out that we need to find and load patches in a config.to_prepare hook - the hard way, because Flickwerk 0.2 broke quite a few other gems and extensions.
The new release has that fixes and offers a new API for class aliases like
"Spree.user_class" => "Spree::User"
.Checklist
Check out our PR guidelines for more details.
The following are mandatory for all PRs: