-
Notifications
You must be signed in to change notification settings - Fork 443
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 accommodations for component-local config #2124
base: main
Are you sure you want to change the base?
Conversation
161cee3
to
6378768
Compare
Unfortunately for us, it's the first line of the API docs 😬 so I think we'll need to make this change in 4.0 or implement it in a non-breaking fashion. How do you think we should proceed? |
It might be possible to rename the This PR needed a rebase anyway, so I'll try to address that in the process. |
e9592cb
to
37e6d0d
Compare
I've made it so that Once we have the structure for component-local config in place, we can start looking at moving config options out of global and into local config one by one. There are a couple of ways we can go about this:
|
37e6d0d
to
2dcc88d
Compare
Introduces a `ViewComponent::GlobalConfig` object that will be the source for global configuration going forward. Ideally in the future, this will only house options that universally affect ViewComponent regardless of whether components are sourced from an engine or not (e.g. enabling the capture compatibility patch), and more options can move to a component-local config. For these options, classes inheriting from `ViewComponent::Base` will want to override configuration themselves. This was initially written to support extracting the incoming strict_helpers_enabled? option, but applies to everything.
2dcc88d
to
62e0960
Compare
@boardfish sorry for the delay in reviewing your PR, I was on vacation last week and am just now getting to it! Having seen this set of changes and #1987, I feel like I'm missing a clear sense of exactly the end state we're hoping to migrate for. What would be helpful for me is something like this:
For all of our configuration API. Do you think you could put together that list for us to discuss? I think we need to make sure we agree on the proposed API changes and that they are even feasible to make. |
@boardfish I took a first crack at listing them all out. Here they are with my notes:
If it's easier, I shared a Google Doc with you we can collaborate on 🤷🏻 |
@joelhawksley Thanks for putting that together! A cursory look through seems to suggest that's all right, but On reflection, the implementation of GlobalConfig shouldn't change behaviour right this second, but I could do with understanding how that might need to change depending on whether we're in an engine or not. It might be possible for us to roll that out as opt-in before v4. |
Explicitly declares access to current config as global where necessary, and makes it possible for us to introduce a component-local config that inherits from these global options in future.
Unsure of how this interacts with gems with engines that depend on ViewComponent, but I'm hoping in the long run it's a step in the right direction for them that'll allow them to have their own
ApplicationComponent
equivalents that inherit their config from ViewComponent's own defaults.