[State Management] State syncing utilities - remove AppState from Dashboard app#54105
Conversation
c7a861e to
415095b
Compare
improve improve improve improve
415095b to
5073715
Compare
|
Pinging @elastic/kibana-app-arch (Team:AppArch) |
…agment/state-sync-dashboard
|
Nothing major, but probably worth looking into: If full screen mode is toggled by changing the state in the rison encoded URL parameter, data gets fetched again. I looked into this a bit and it seems like the |
flash1293
left a comment
There was a problem hiding this comment.
Some nits, but dashboard integration LGTM - works great, thanks! There is one difference I noticed but it's not a blocker for merging this. I noticed that requests are triggered in a lot of places when they are not necessary (e.g. when changing "showMargins" setting), but this is also happening on master. I will create a separate issue for that.
src/legacy/core_plugins/data/public/filter/filter_manager/filter_state_manager.ts
Outdated
Show resolved
Hide resolved
src/legacy/core_plugins/kibana/public/dashboard/np_ready/dashboard_app.tsx
Show resolved
Hide resolved
src/legacy/core_plugins/kibana/public/dashboard/np_ready/dashboard_app_controller.tsx
Outdated
Show resolved
Hide resolved
src/legacy/core_plugins/kibana/public/dashboard/np_ready/dashboard_app_controller.tsx
Show resolved
Hide resolved
src/legacy/core_plugins/kibana/public/dashboard/np_ready/dashboard_state_manager.ts
Outdated
Show resolved
Hide resolved
src/legacy/core_plugins/kibana/public/dashboard/np_ready/dashboard_state_manager.ts
Show resolved
Hide resolved
src/legacy/core_plugins/kibana/public/dashboard/np_ready/dashboard_app_controller.tsx
Outdated
Show resolved
Hide resolved
…agment/state-sync-dashboard # Conflicts: # src/legacy/core_plugins/kibana/public/dashboard/np_ready/dashboard_state.test.ts
@flash1293, Good catch! this particular case is fixed by utilising "applyDiff" utility from old state_management in new state syncing utils.
Now it seems like, that it happens only when filters are applied, likely is going to be fixed together with: |
lizozom
left a comment
There was a problem hiding this comment.
Tested and reviewed code LGTM
However, for the protocol, why did this change require adding getPendingUrl and supporting returning undefined from update in kbn_url_storage
| private saveState() { | ||
| const appState = this.getAppState(); | ||
| if (appState) appState.save(); | ||
| if (appState && appState.save) appState.save(); |
There was a problem hiding this comment.
Why would we get an appState without a save method?
There was a problem hiding this comment.
This filter_state_management is still used in Dashboard (until next pr, where we will remove global state also)
So, as we removed AppState from Dashboard, I change the interface of filter_state_manager to :
https://github.com/elastic/kibana/pull/54105/files/10fe7772a3297f9e5b03591dd9d47a5b8ca9be02#diff-e99af5c3c776f37f6e37ab25d094e3cfR25
And save function is for legacy AppState case, but new state sync utils don't have explicit save() method.
src/legacy/core_plugins/kibana/public/dashboard/np_ready/types.ts
Outdated
Show resolved
Hide resolved
…agment/state-sync-dashboard
I don't remember exactly the edge case I was fighting, but in a nutshell it was something like this: |
|
retest |
…agment/state-sync-dashboard
|
@elasticmachine merge upstream |
…agment/state-sync-dashboard # Conflicts: # src/legacy/core_plugins/data/public/filter/filter_manager/filter_state_manager.ts
|
retest |
💚 Build SucceededHistory
To update your PR or re-run it, just comment with: |
Removes AppState from dashboard app and replaces it with state containers and state syncing utilities.
* master: [State Management] remove AppState from Dashboard app (elastic#54105) Expose fatalErrors API from the Start contract (elastic#55300) [BUG] Data fetching twice on discover timefilter change (elastic#55279) [Mappings editor] Add missing max_shingle_size parameter to search_as_you_type (elastic#55161) [Logs UI] Fix z-index of logs page toolbar (elastic#54469) removes CTA from Task Manager info message (elastic#55334)
Summary
Depends on #53582Part of #44151
Removes AppState from dashboard app and replaces it with state containers and state syncing utilities.
There is also follow up in progress which also removes global state:
#55158
Disclamer
I didn't try to refactor the state management in Dashboard in scope of this (as new state_containers give us more flexibility).
Just tried to replace AppState -> State Containers with minimal changes
Checklist
Use
strikethroughsto remove checklist items you don't feel are applicable to this PR.For maintainers