Skip to content

Commit

Permalink
fix(query-devtools): handle null properties for __previousQueryOptions (
Browse files Browse the repository at this point in the history
#8240)

Co-authored-by: Dominik Dorfmeister <office@dorfmeister.cc>
  • Loading branch information
kaehehehe and TkDodo authored Nov 3, 2024
1 parent 92defc6 commit 9c93dc0
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions packages/query-devtools/src/Devtools.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1789,15 +1789,20 @@ const QueryDetails = () => {
const restoreQueryAfterLoadingOrError = () => {
const activeQueryVal = activeQuery()!
const previousState = activeQueryVal.state
const previousOptions = (activeQueryVal.state.fetchMeta as any)
.__previousQueryOptions
const previousOptions = activeQueryVal.state.fetchMeta
? (activeQueryVal.state.fetchMeta as any).__previousQueryOptions
: null

activeQueryVal.cancel({ silent: true })
activeQueryVal.setState({
...previousState,
fetchStatus: 'idle',
fetchMeta: null,
})
activeQueryVal.fetch(previousOptions)

if (previousOptions) {
activeQueryVal.fetch(previousOptions)
}
}

createEffect(() => {
Expand Down

0 comments on commit 9c93dc0

Please sign in to comment.