mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
Clear async storage on error
This commit is contained in:
parent
bdb31137bd
commit
d672fe1b44
1 changed files with 7 additions and 0 deletions
|
|
@ -2,8 +2,15 @@
|
|||
import NextErrorComponent from 'next/error'
|
||||
|
||||
import * as Sentry from '@sentry/nextjs'
|
||||
import { useEffect } from 'react'
|
||||
import AsyncStorage from '@react-native-async-storage/async-storage'
|
||||
|
||||
const MyError = ({ statusCode, hasGetInitialPropsRun, err }: any) => {
|
||||
useEffect(() => {
|
||||
console.log('unhandled exception occurred, clearing cached data.')
|
||||
AsyncStorage.clear()
|
||||
}, [])
|
||||
|
||||
if (!hasGetInitialPropsRun && err) {
|
||||
// getInitialProps is not called in case of
|
||||
// https://github.com/vercel/next.js/issues/8592. As a workaround, we pass
|
||||
|
|
|
|||
Loading…
Reference in a new issue