diff --git a/lib/reducers/master-reducer.js b/lib/reducers/master-reducer.js --- a/lib/reducers/master-reducer.js +++ b/lib/reducers/master-reducer.js @@ -38,6 +38,7 @@ keyserverStoreOpsHandlers, type ReplaceKeyserverOperation, } from '../ops/keyserver-store-ops.js'; +import { syncedMetadataStoreOpsHandlers } from '../ops/synced-metadata-store-ops.js'; import { isStaff } from '../shared/staff-utils.js'; import { processDMOpsActionType } from '../types/dm-ops.js'; import type { BaseNavInfo } from '../types/nav-types.js'; @@ -180,17 +181,34 @@ threadStoreOperations, ); - const { enabledApps } = reduceEnabledApps(state.enabledApps, action); + const { enabledApps, syncedMetadataStoreOperations: enabledAppsOps } = + reduceEnabledApps(state.enabledApps, action); - const { globalThemeInfo } = reduceGlobalThemeInfo( - state.globalThemeInfo, - action, - ); + const { globalThemeInfo, syncedMetadataStoreOperations: globalThemeInfoOps } = + reduceGlobalThemeInfo(state.globalThemeInfo, action); - const { alertStore } = reduceAlertStore(state.alertStore, action); + const { alertStore, syncedMetadataStoreOperations: alertStoreOps } = + reduceAlertStore(state.alertStore, action); - const { syncedMetadataStore, syncedMetadataStoreOperations } = - reduceSyncedMetadataStore(state.syncedMetadataStore, action); + const predefinedSyncedMetadataStoreOperations = [ + ...enabledAppsOps, + ...globalThemeInfoOps, + ...alertStoreOps, + ]; + const updatedSyncedMetadataStore = + syncedMetadataStoreOpsHandlers.processStoreOperations( + state.syncedMetadataStore, + predefinedSyncedMetadataStoreOperations, + ); + const { + syncedMetadataStore, + syncedMetadataStoreOperations: syncedMetadataStoreOperationsFromReducer, + } = reduceSyncedMetadataStore(updatedSyncedMetadataStore, action); + + const syncedMetadataStoreOperations = [ + ...predefinedSyncedMetadataStoreOperations, + ...syncedMetadataStoreOperationsFromReducer, + ]; const { auxUserStore, auxUserStoreOperations } = reduceAuxUserStore( state.auxUserStore,