Skip to content

Commit

Permalink
fix(query-devtools): Fix Trigger Loading Button (#7188)
Browse files Browse the repository at this point in the history
  • Loading branch information
ardeora committed Mar 27, 2024
1 parent 2330584 commit ffad09d
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions packages/query-devtools/src/Devtools.tsx
Expand Up @@ -1934,13 +1934,17 @@ const QueryDetails = () => {
}

const restoreQueryAfterLoadingOrError = () => {
activeQuery()?.fetch(
(activeQuery()?.state.fetchMeta as any).__previousQueryOptions,
{
// Make sure this fetch will cancel the previous one
cancelRefetch: true,
},
)
const activeQueryVal = activeQuery()!
const previousState = activeQueryVal.state
const previousOptions = (activeQueryVal.state.fetchMeta as any)
.__previousQueryOptions
activeQueryVal.cancel({ silent: true })
activeQueryVal.setState({
...previousState,
fetchStatus: 'idle',
fetchMeta: null,
})
activeQueryVal.fetch(previousOptions)
}

createEffect(() => {
Expand Down

0 comments on commit ffad09d

Please sign in to comment.