-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Migrate injected UiSettings from legacyMetadata #22779
Comments
Kibana stores all the uiSettings in Elasticsearch. Shouldn't Elasticsearch be the only source of truth for the uiSettings? A user can change a setting in another tab, or have a long-running session with NP SPA mode. Effectively it means we should not use local state on the client anymore. |
I would like to agree, however looking at the current implementation of the client-side client in
So overall, these may not be trivial changes. Do we want to do this at the same time we are removing usages of |
I personally don't think there's value in making uiSettings async. The things that are changed through uiSettings have historically been things which can update on the next refresh without issue. Is that changing or are we just trying to make things more conceptually pure? I think a little client side caching for something like this is pretty practically useful and hasn't caused an issue in the past AFAIK. |
That was probably alright when switching application was causing a full page reload. Now that Kibana is a real SPA, the uiSettings are effectively loaded only once, at the initial application startup, which make me wonder if this is still acceptable. |
Yeah, that's something I hadn't considered. Still don't think the work required to make the APIs async/observable and convert all the usage to the updated APIs is worth it but 🤷 |
It may not be, I'm genuinely asking the question. Some kind of interval-based resync from the client to the server could also be an option that would preserve the client-side API as synchronous. |
Yeah, perhaps it could be integrated into app router switching so that the uiSettings won't change while a user is in the middle of using an app, but if they haven't been updated in a while core could refresh them on the next app -> app transition, before mounting the app? |
Pinging @elastic/appex-sharedux (Team:SharedUX) |
In #22694 we are moving the creation of the UiSettingsClient from the legacy platform to the new platform, but we intentionally left the
UiSettingsClient
dependent on the legacy metadata to avoid too many unnecessary changes in this PR.The legacy metadata currently includes two objects that are merged together to create an internal cache of the ui settings state:
uiSettings.defaults
anduiSettings.user
. Once these objects are merged they are used to lookup information about each settings and are regularly mutated when settings are changed, sometimes by directly setting certain properties and sometimes by merging in responses from the uiSettings API. This makes it hard for me to understand what the state of the internal cache is after a given operation, so I'd like to rethink things a little bit starting by refactoring the injected vars and then refactoring the way they're consumed by theUiSettingsClient
.The text was updated successfully, but these errors were encountered: