Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3716643
D9914.id33330.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
D9914.id33330.diff
View Options
diff --git a/lib/reducers/message-reducer.test.js b/lib/reducers/message-reducer.test.js
--- a/lib/reducers/message-reducer.test.js
+++ b/lib/reducers/message-reducer.test.js
@@ -290,6 +290,7 @@
messageStoreThreads: clientDBThreads,
messages: clientDBMessages,
reports: [],
+ users: {},
},
},
{
diff --git a/lib/reducers/user-reducer.js b/lib/reducers/user-reducer.js
--- a/lib/reducers/user-reducer.js
+++ b/lib/reducers/user-reducer.js
@@ -3,6 +3,7 @@
import _isEqual from 'lodash/fp/isEqual.js';
import _keyBy from 'lodash/fp/keyBy.js';
+import { setClientDBStoreActionType } from '../actions/client-db-store-actions.js';
import { siweAuthActionTypes } from '../actions/siwe-actions.js';
import {
joinThreadActionTypes,
@@ -396,6 +397,17 @@
}
: state;
return [newState, [], userStoreOps];
+ } else if (action.type === setClientDBStoreActionType) {
+ if (!action.payload.users) {
+ return [state, [], []];
+ }
+ assertUserStoresAreEqual(
+ action.payload.users ?? {},
+ state.userInfos,
+ action.type,
+ onStateDifference,
+ );
+ return [state, [], []];
}
return [state, [], []];
diff --git a/lib/types/redux-types.js b/lib/types/redux-types.js
--- a/lib/types/redux-types.js
+++ b/lib/types/redux-types.js
@@ -120,7 +120,7 @@
RoleDeletionPayload,
} from './thread-types.js';
import type { ClientUpdatesResultWithUserInfos } from './update-types.js';
-import type { CurrentUserInfo, UserStore } from './user-types.js';
+import type { CurrentUserInfo, UserInfos, UserStore } from './user-types.js';
import type { SetDeviceTokenActionPayload } from '../actions/device-actions.js';
import type { Shape } from '../types/core.js';
import type { NotifPermissionAlertInfo } from '../utils/push-alerts.js';
@@ -659,6 +659,7 @@
+threadStore: ?ThreadStore,
+messageStoreThreads: ?$ReadOnlyArray<ClientDBThreadMessageInfo>,
+reports: ?$ReadOnlyArray<ClientReportCreationRequest>,
+ +users: ?UserInfos,
},
}
| {
diff --git a/native/data/sqlite-data-handler.js b/native/data/sqlite-data-handler.js
--- a/native/data/sqlite-data-handler.js
+++ b/native/data/sqlite-data-handler.js
@@ -8,6 +8,7 @@
import { MediaCacheContext } from 'lib/components/media-cache-provider.react.js';
import { reportStoreOpsHandlers } from 'lib/ops/report-store-ops.js';
import { threadStoreOpsHandlers } from 'lib/ops/thread-store-ops.js';
+import { userStoreOpsHandlers } from 'lib/ops/user-store-ops.js';
import {
cookieSelector,
urlPrefixSelector,
@@ -168,12 +169,19 @@
mediaCacheContext?.evictCache(),
]);
try {
- const { threads, messages, drafts, messageStoreThreads, reports } =
- await commCoreModule.getClientDBStore();
+ const {
+ threads,
+ messages,
+ drafts,
+ messageStoreThreads,
+ reports,
+ users,
+ } = await commCoreModule.getClientDBStore();
const threadInfosFromDB =
threadStoreOpsHandlers.translateClientDBData(threads);
const reportsFromDb =
reportStoreOpsHandlers.translateClientDBData(reports);
+ const usersFromDb = userStoreOpsHandlers.translateClientDBData(users);
dispatch({
type: setClientDBStoreActionType,
@@ -184,6 +192,7 @@
currentUserID: currentLoggedInUserID,
messageStoreThreads,
reports: reportsFromDb,
+ users: usersFromDb,
},
});
} catch (setStoreException) {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Jan 9, 9:54 AM (9 h, 26 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2832179
Default Alt Text
D9914.id33330.diff (3 KB)
Attached To
Mode
D9914: [native] read users from SQLite on app start
Attached
Detach File
Event Timeline
Log In to Comment