mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
Clear the queryClient on error
This commit is contained in:
parent
d672fe1b44
commit
6cb14f3ed3
1 changed files with 3 additions and 2 deletions
|
|
@ -3,12 +3,13 @@ import NextErrorComponent from 'next/error'
|
|||
|
||||
import * as Sentry from '@sentry/nextjs'
|
||||
import { useEffect } from 'react'
|
||||
import AsyncStorage from '@react-native-async-storage/async-storage'
|
||||
import { useQueryClient } from '@tanstack/react-query'
|
||||
|
||||
const MyError = ({ statusCode, hasGetInitialPropsRun, err }: any) => {
|
||||
const queryClient = useQueryClient()
|
||||
useEffect(() => {
|
||||
console.log('unhandled exception occurred, clearing cached data.')
|
||||
AsyncStorage.clear()
|
||||
queryClient.clear()
|
||||
}, [])
|
||||
|
||||
if (!hasGetInitialPropsRun && err) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue