You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Today, apps rely on AppState and GlobalState in the ui/state_management module to deal with internal (app) and shared (global) state. These classes give apps an ability to read/write state, when is then synced to the URL as well as sessionStorage. They also react to changes in the URL and automatically update state & emit events when changes occur.
In the new platform, we don't have the concept of global state, and each app will be responsible for managing its own state and "opting in" to syncing with the URL and/or sessionStorage, as discussed in #39855.
The overall migration strategy outlined in this issue boils down to a few static utilities that live in src/plugins/kibana_utils:
kibana_utils/state_containers: These are redux-like state containers that apps can use to manage their state and respond to updates.
kibana_utils/storage: A lightweight wrapper around the getters/setters for both local & session storage.
new - kibana_utils/state_management/url, kibana_utils/state_management/state_hash, kibana_utils/state_management/state_encoder: Utilities for interacting with urls by hashing/unhashing and dealing with rison encoding/decoding
new - kibana_utils/state_sync: Replacement for appState that handles syncing an app's state with url/storage, as well as updating state containers based on shared "global" state changes from other services, such as filters & timepicker.
state_hashing
Utility functions to create hash url from state and vice versa
create a state syncing utility that takes in an array of IBaseStateContainer interfaces, subscribes to state changes, and syncs the data to some storage. (Url, sessionStorage, localStorage, etc..) [State Management] State syncing utilities #53582
global_state
Same as app state, only for data that is to be shared between apps
this basically goes away, as global state will be tracked by the same IState interface that gets passed to the state sync utility
ui/state_management migration plan
Overview
Today, apps rely on AppState and GlobalState in the
ui/state_managementmodule to deal with internal (app) and shared (global) state. These classes give apps an ability to read/write state, when is then synced to the URL as well as sessionStorage. They also react to changes in the URL and automatically update state & emit events when changes occur.In the new platform, we don't have the concept of global state, and each app will be responsible for managing its own state and "opting in" to syncing with the URL and/or sessionStorage, as discussed in #39855.
The overall migration strategy outlined in this issue boils down to a few static utilities that live in
src/plugins/kibana_utils:state_hashing
Utility functions to create hash url from state and vice versa
src/plugins/kibana_utils[State Management] Move url state_hashing utils to kibana_utils #52280state_storage
Handles storing/retrieving hashed items into sessionStorage and clearing stale items
storageinsrc/plugins/kibana_utils/storageto simplifysrc/plugins/kibana_utils[7.x] [State Management] Move HashedItemStore to kibana_utils plugin. Make it stateless on memory level. (#52172) #52271app_state
Provides a way to make state auto-persist to url/sessionStorage on change by letting apps read/write state
POC in progress:
POC:
_guse case [State Management] State syncing utilities #53582Implementation:
IBaseStateContainerinterfaces, subscribes to state changes, and syncs the data to some storage. (Url, sessionStorage, localStorage, etc..) [State Management] State syncing utilities #53582global_state
Same as app state, only for data that is to be shared between apps
IStateinterface that gets passed to the state sync utilitystate
Base class for both App & Global State; provides logic to read/write the state (from/to url/sessionStorage)
state_monitor_factory
Watches for state changes & emits events
state_management_config_provider
Allows apps to configure state management by enabling/disabling
migrate apps to use state_containers and new utility functions - as a good example on how to use
Utilities and docs for syncing with data services
dataplugin services discussion [State Management] State syncing helpers for query service I #56128Support other apps with migrating away from GlobalState & AppState
When everything is migrated - remove AppState & GlobalState & state_monitor_factory
New Work
Parent issue: #31968