diff --git a/lib/reducers/aux-user-reducer.js b/lib/reducers/aux-user-reducer.js --- a/lib/reducers/aux-user-reducer.js +++ b/lib/reducers/aux-user-reducer.js @@ -1,6 +1,7 @@ // @flow import { setFarcasterFriendsFIDActionType } from '../actions/aux-user-actions.js'; +import { setClientDBStoreActionType } from '../actions/client-db-store-actions.js'; import { auxUserStoreOpsHandlers, type AuxUserStoreOperation, @@ -36,7 +37,27 @@ auxUserStore: processStoreOps(state, replaceOperations), auxUserStoreOperations: replaceOperations, }; + } else if (action.type === setClientDBStoreActionType) { + const newAuxUserInfos = action.payload.auxUserInfos; + + if (!newAuxUserInfos) { + return { + auxUserStore: state, + auxUserStoreOperations: [], + }; + } + + const newAuxUserStore: AuxUserStore = { + ...state, + auxUserInfos: newAuxUserInfos, + }; + + return { + auxUserStore: newAuxUserStore, + auxUserStoreOperations: [], + }; } + return { auxUserStore: state, auxUserStoreOperations: [], 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 @@ -295,6 +295,7 @@ communityInfos: {}, threadHashes: {}, syncedMetadata: {}, + auxUserInfos: {}, }, }, { diff --git a/lib/types/store-ops-types.js b/lib/types/store-ops-types.js --- a/lib/types/store-ops-types.js +++ b/lib/types/store-ops-types.js @@ -1,5 +1,6 @@ // @flow +import type { AuxUserInfos } from './aux-user-types.js'; import type { CommunityInfos } from './community-types.js'; import type { DraftStoreOperation, @@ -109,4 +110,5 @@ +communityInfos: ?CommunityInfos, +threadHashes: ?ThreadHashes, +syncedMetadata: ?SyncedMetadata, + +auxUserInfos: ?AuxUserInfos, }; 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 @@ -7,6 +7,7 @@ import { MediaCacheContext } from 'lib/components/media-cache-provider.react.js'; import type { CallKeyserverEndpoint } from 'lib/keyserver-conn/keyserver-conn-types.js'; import { useKeyserverRecoveryLogIn } from 'lib/keyserver-conn/recovery-utils.js'; +import { auxUserStoreOpsHandlers } from 'lib/ops/aux-user-store-ops.js'; import { communityStoreOpsHandlers } from 'lib/ops/community-store-ops.js'; import { integrityStoreOpsHandlers } from 'lib/ops/integrity-store-ops.js'; import { keyserverStoreOpsHandlers } from 'lib/ops/keyserver-store-ops.js'; @@ -210,6 +211,7 @@ communities, integrityThreadHashes, syncedMetadata, + auxUserInfos, } = await commCoreModule.getClientDBStore(); const threadInfosFromDB = threadStoreOpsHandlers.translateClientDBData(threads); @@ -226,6 +228,8 @@ ); const syncedMetadataFromDB = syncedMetadataStoreOpsHandlers.translateClientDBData(syncedMetadata); + const auxUserInfosFromDB = + auxUserStoreOpsHandlers.translateClientDBData(auxUserInfos); dispatch({ type: setClientDBStoreActionType, @@ -241,6 +245,7 @@ communities: communityInfosFromDB, threadHashes: threadHashesFromDB, syncedMetadata: syncedMetadataFromDB, + auxUserInfos: auxUserInfosFromDB, }, }); } catch (setStoreException) { diff --git a/web/shared-worker/utils/store.js b/web/shared-worker/utils/store.js --- a/web/shared-worker/utils/store.js +++ b/web/shared-worker/utils/store.js @@ -31,6 +31,7 @@ communityInfos: null, threadHashes: null, syncedMetadata: null, + auxUserInfos: null, }; const data = await sharedWorker.schedule({ type: workerRequestMessageTypes.GET_CLIENT_STORE, @@ -89,6 +90,14 @@ ), }; } + if (data?.store?.auxUserInfos) { + result = { + ...result, + auxUserInfos: auxUserStoreOpsHandlers.translateClientDBData( + data.store.auxUserInfos, + ), + }; + } return result; }