Clear the queryClient on error

This commit is contained in:
Jackson Harper
2024-08-20 18:17:27 +08:00
parent d672fe1b44
commit 6cb14f3ed3

View File

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