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
This commit is contained in:
Kartik Gupta 2024-07-31 14:02:23 +05:30 committed by GitHub
parent 795c925b54
commit 5bb033f7e3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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
);