-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Conversation
Bundle size report 📦
Look at the Statoscope report for a full comparison between the commits 0d1154a and acd88ab or learn more. Open explanation
|
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.
I've long awaited this. 😍 EAGERLY APPROVE. 👍👍👍👍
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.
@philipp-spiess Nice change, only one thought about \useExperimentalFeatures\ hook, at the moment, it works via zustand global store (not just a context), but this hook is related to your change because there is a two options now to get experimental settings (three actually if we count prop drilling)
Do you think we could (maybe as a follow-up) migrate \useExperimentalFeatures\ to the version where this hook uses your new useSetting
hook internally (and doesn't use different approach with global zustand store)
@vovakulikov Yes, this would be great! Do you know why we have |
Lol, what? 😃 |
I got the same question when refactoring the root search query state observer. Maybe @fkling can chime in and share more context? The only reason that comes to my mind based on my limited experience with this part of the codebase is that |
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.
Seeing the prop drilling of the settings cascade gradually disappear will be so pleasant!
I decided to not replace all of the props drilling just yet
I also really want to focus on cleaning up the app shell instead
Love this line of reasoning! We can move faster if we prioritize migrations in the app shell and component under Storm routes (the first one will be the home page). Then we can gradually move route by route into the storm and refactor them incrementally. Sadly it wasn't possible with the react-router migration, but it should work without issues with our internal deprecated APIs!
Mainly two reasons:
I guess it should be relatively straightforward to simply change the internal implementation of |
Oh, I see. Yeah this is something that the Context API doesn't allow (yet, but it doesn't seem a priority either). I know of one place only where we depend on setting for something inside the current page and that is when configuring IDE extensions but it's something that is done at most ones (every subsequent setting change is expected to happen from inside the settings page). I wonder if it would be cleaner if we would just require a browser refresh when settings change. We could get rid of a lot of settings based propagation code if we can consider it readonly and static 🤔 Anyway this is a discussion for a different day :) |
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.
Oh wow, this seems life changing! Thank you! ❤️
This PR changes the `useExperimentalFeatures` hook to use the new `useSettings` API as discussed in #47979.
Inspired by Vova's #47864, this adds a new
useSettings()
hook to replace the existingSettingsCascadeProps
prop drilling.I decided to not replace all of the props drilling just yet to avoid a massive merge conflict when Vova's PR ships. I also really want to focus on cleaning up the app shell instead and I need this particularly for one use case: Cleaning up
globbing
which, as it turns out, is just a computed value from the setting instead.With this new settings API in place, I want to start trimming the shared props mess in a follow-up PR. This will then already remove the needs to pass the settings cascade around naturally and we will end up with a few smaller issues instead of a high change of breaking things.
I've also marked the existing settings APIs (including access to the
SettingsCascade
object directly) as deprecated.useSettings()
should be used when possible. I don't think we need to validate the settings in every caller manually. 😅Test plan
console.log(useSettings())
to a routeApp preview:
Check out the client app preview documentation to learn more.