Page MenuHomePhabricator

D4517.id14435.diff
No OneTemporary

D4517.id14435.diff

diff --git a/native/data/sqlite-context-provider.js b/native/data/sqlite-context-provider.js
--- a/native/data/sqlite-context-provider.js
+++ b/native/data/sqlite-context-provider.js
@@ -17,12 +17,7 @@
};
function SQLiteContextProvider(props: Props): React.Node {
- const [threadStoreLoaded, setThreadStoreLoaded] = React.useState<boolean>(
- false,
- );
- const [messageStoreLoaded, setMessageStoreLoaded] = React.useState<boolean>(
- false,
- );
+ const [storeLoaded, setStoreLoaded] = React.useState<boolean>(false);
const dispatch = useDispatch();
const rehydrateConcluded = useSelector(
@@ -32,7 +27,7 @@
const urlPrefix = useSelector(state => state.urlPrefix);
React.useEffect(() => {
- if ((threadStoreLoaded && messageStoreLoaded) || !rehydrateConcluded) {
+ if (storeLoaded || !rehydrateConcluded) {
return;
}
(async () => {
@@ -58,25 +53,16 @@
sqliteLoadFailure,
);
} finally {
- setThreadStoreLoaded(true);
- setMessageStoreLoaded(true);
+ setStoreLoaded(true);
}
})();
- }, [
- threadStoreLoaded,
- urlPrefix,
- rehydrateConcluded,
- cookie,
- dispatch,
- messageStoreLoaded,
- ]);
+ }, [storeLoaded, urlPrefix, rehydrateConcluded, cookie, dispatch]);
const contextValue = React.useMemo(
() => ({
- threadStoreLoaded,
- messageStoreLoaded,
+ storeLoaded,
}),
- [threadStoreLoaded, messageStoreLoaded],
+ [storeLoaded],
);
return (
diff --git a/native/data/sqlite-context.js b/native/data/sqlite-context.js
--- a/native/data/sqlite-context.js
+++ b/native/data/sqlite-context.js
@@ -3,8 +3,7 @@
import * as React from 'react';
export type SQLiteContextType = {
- +threadStoreLoaded: boolean,
- +messageStoreLoaded: boolean,
+ +storeLoaded: boolean,
};
const SQLiteContext: React.Context<?SQLiteContextType> = React.createContext(
diff --git a/native/navigation/app-navigator.react.js b/native/navigation/app-navigator.react.js
--- a/native/navigation/app-navigator.react.js
+++ b/native/navigation/app-navigator.react.js
@@ -165,9 +165,7 @@
const localDatabaseContext: ?SQLiteContextType = React.useContext(
SQLiteContext,
);
- const storeLoadedFromLocalDatabase =
- localDatabaseContext?.threadStoreLoaded &&
- localDatabaseContext?.messageStoreLoaded;
+ const storeLoadedFromLocalDatabase = localDatabaseContext?.storeLoaded;
const setNavStateInitialized =
rootContext && rootContext.setNavStateInitialized;
React.useEffect(() => {
diff --git a/native/selectors/app-state-selectors.js b/native/selectors/app-state-selectors.js
--- a/native/selectors/app-state-selectors.js
+++ b/native/selectors/app-state-selectors.js
@@ -9,11 +9,7 @@
const rehydrateConcluded = useSelector(state => !!state._persist?.rehydrated);
const localDatabaseContext = React.useContext(SQLiteContext);
- return (
- rehydrateConcluded &&
- !!localDatabaseContext?.threadStoreLoaded &&
- !!localDatabaseContext?.messageStoreLoaded
- );
+ return rehydrateConcluded && !!localDatabaseContext?.storeLoaded;
}
export { usePersistedStateLoaded };

File Metadata

Mime Type
text/plain
Expires
Tue, Oct 8, 5:31 AM (22 h, 5 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2257750
Default Alt Text
D4517.id14435.diff (3 KB)

Event Timeline