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

Fix startup issues #3

Merged
merged 2 commits into from
Dec 18, 2024
Merged

Fix startup issues #3

merged 2 commits into from
Dec 18, 2024

Conversation

mamhoff
Copy link
Contributor

@mamhoff mamhoff commented Dec 18, 2024

Prior to these commits, Flickwerk patches were evaluated as part of the initializer chain. These commit move them to the config.to_prepare hook, which runs after all initializers. Running autoloader.cpath_expected_at(const_string) led to undesirable results when, for example, initializers definining inflections had not run before.

This change removes the clearly defined spot to manipulate the set of patches before loading them, which we used in solidus_support 0.11 for transforming keys with "Spree.user_class" to whatever the actual user class was. In order to be able to have that feature anyways, we add an aliases attribute that can be filled early-on with a mapping, and Flickwerk.patch will respect that mapping. That way, Flickwerk.patches won't contain un-constantizable classes in the first place.

Without this, Flickwerk messes up the boot sequence of Rails enough that
even loading inflections stops working. That's way there's a new
"UI/Button" class in the specs now, that class does not load without the
changes to the Railtie.
In the Solidus ecosystem, the user class is configurable, and many
extensions patch the user class using a pattern like
`Spree.user_class.prepend`. `Spree.user_class` is not a string, and
can't be constantized, so we need to replace it with the actual class
name before patching. This commit accomplishes that.
@mamhoff mamhoff merged commit 337b639 into main Dec 18, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants