From 5bb033f7e33c7e5af987e7c14102e9816662c6ce Mon Sep 17 00:00:00 2001 From: Kartik Gupta Date: Wed, 31 Jul 2024 14:02:23 +0530 Subject: [PATCH] Fix/query state issue (#10531) * add consume state directly from store instead of param when currentState store initialises * add consume state directly from store instead of param when currentState store initialises --- frontend/src/_stores/currentStateStore.js | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/frontend/src/_stores/currentStateStore.js b/frontend/src/_stores/currentStateStore.js index 63eca0998b..96b24dec83 100644 --- a/frontend/src/_stores/currentStateStore.js +++ b/frontend/src/_stores/currentStateStore.js @@ -106,16 +106,18 @@ useCurrentStateStore.subscribe((state) => { handleLowPriorityWork( () => { + const currentState = useCurrentStateStore.getState(); useResolveStore.getState().actions.addAppSuggestions( { - queries: state.queries, - components: !isPageSwitched ? state.components : {}, - globals: state.globals, - page: state.page, - variables: state.variables, - client: state.client, - server: state.server, - constants: state.constants, + // get state directly to prevent consuming stale data + queries: currentState.queries, + components: !isPageSwitched ? currentState.components : {}, + globals: currentState.globals, + page: currentState.page, + variables: currentState.variables, + client: currentState.client, + server: currentState.server, + constants: currentState.constants, }, true );