Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3499826
D4159.id13278.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D4159.id13278.diff
View Options
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
@@ -8,6 +8,7 @@
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';
@@ -19,6 +20,9 @@
const [threadStoreLoaded, setThreadStoreLoaded] = React.useState<boolean>(
false,
);
+ const [messageStoreLoaded, setMessageStoreLoaded] = React.useState<boolean>(
+ false,
+ );
const dispatch = useDispatch();
const rehydrateConcluded = useSelector(
@@ -28,9 +32,12 @@
const urlPrefix = useSelector(state => state.urlPrefix);
React.useEffect(() => {
- if (threadStoreLoaded || !rehydrateConcluded) {
+ if ((threadStoreLoaded && messageStoreLoaded) || !rehydrateConcluded) {
return;
}
+ if (persistConfig.version < 31) {
+ setMessageStoreLoaded(true);
+ }
(async () => {
try {
const threads = await global.CommCoreModule.getAllThreads();
@@ -52,13 +59,21 @@
setThreadStoreLoaded(true);
}
})();
- }, [threadStoreLoaded, urlPrefix, rehydrateConcluded, cookie, dispatch]);
+ }, [
+ threadStoreLoaded,
+ urlPrefix,
+ rehydrateConcluded,
+ cookie,
+ dispatch,
+ messageStoreLoaded,
+ ]);
const contextValue = React.useMemo(
() => ({
threadStoreLoaded,
+ messageStoreLoaded,
}),
- [threadStoreLoaded],
+ [threadStoreLoaded, messageStoreLoaded],
);
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
@@ -4,6 +4,7 @@
export type SQLiteContextType = {
+threadStoreLoaded: boolean,
+ +messageStoreLoaded: 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,7 +165,9 @@
const localDatabaseContext: ?SQLiteContextType = React.useContext(
SQLiteContext,
);
- const storeLoadedFromLocalDatabase = localDatabaseContext?.threadStoreLoaded;
+ const storeLoadedFromLocalDatabase =
+ localDatabaseContext?.threadStoreLoaded &&
+ localDatabaseContext?.messageStoreLoaded;
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,7 +9,11 @@
const rehydrateConcluded = useSelector(state => !!state._persist?.rehydrated);
const localDatabaseContext = React.useContext(SQLiteContext);
- return rehydrateConcluded && !!localDatabaseContext?.threadStoreLoaded;
+ return (
+ rehydrateConcluded &&
+ !!localDatabaseContext?.threadStoreLoaded &&
+ !!localDatabaseContext?.messageStoreLoaded
+ );
}
export { usePersistedStateLoaded };
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Dec 21, 12:15 AM (18 h, 2 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2682146
Default Alt Text
D4159.id13278.diff (3 KB)
Attached To
Mode
D4159: [native] Add `messageStoreLoaded` to `SQLiteContext`
Attached
Detach File
Event Timeline
Log In to Comment