diff --git a/native/data/sqlite-context-provider.js b/native/data/sqlite-context-provider.js index 693e94cee..d4dbcb813 100644 --- a/native/data/sqlite-context-provider.js +++ b/native/data/sqlite-context-provider.js @@ -1,76 +1,71 @@ // @flow import * as React from 'react'; import { useDispatch } from 'react-redux'; import { setThreadStoreActionType } from 'lib/actions/thread-actions'; import { sqliteLoadFailure } from 'lib/actions/user-actions'; import { fetchNewCookieFromNativeCredentials } from 'lib/utils/action-utils'; import { convertClientDBThreadInfosToRawThreadInfos } from 'lib/utils/thread-ops-utils'; -import { persistConfig } from '../redux/persist'; import { useSelector } from '../redux/redux-utils'; import { SQLiteContext } from './sqlite-context'; type Props = { +children: React.Node, }; function SQLiteContextProvider(props: Props): React.Node { const [threadStoreLoaded, setThreadStoreLoaded] = React.useState( false, ); const dispatch = useDispatch(); const rehydrateConcluded = useSelector( state => !!(state._persist && state._persist.rehydrated), ); const cookie = useSelector(state => state.cookie); const urlPrefix = useSelector(state => state.urlPrefix); React.useEffect(() => { if (threadStoreLoaded || !rehydrateConcluded) { return; } - if (persistConfig.version < 30) { - setThreadStoreLoaded(true); - return; - } (async () => { try { const threads = await global.CommCoreModule.getAllThreads(); const threadInfosFromDB = convertClientDBThreadInfosToRawThreadInfos( threads, ); dispatch({ type: setThreadStoreActionType, payload: { threadInfos: threadInfosFromDB }, }); } catch { await fetchNewCookieFromNativeCredentials( dispatch, cookie, urlPrefix, sqliteLoadFailure, ); } finally { setThreadStoreLoaded(true); } })(); }, [threadStoreLoaded, urlPrefix, rehydrateConcluded, cookie, dispatch]); const contextValue = React.useMemo( () => ({ threadStoreLoaded, }), [threadStoreLoaded], ); return ( {props.children} ); } export { SQLiteContextProvider };