move labeler cache to mmkv, make moderation config sync

The per-account labeler cache was the only async dependency in
configureModerationForAccount. MMKV-backed sync reads let session
setup apply labelers in the same tick. No AsyncStorage backfill: the
cache is rewritten on every preferences fetch.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Samuel Newman
2026-07-31 19:01:05 +03:00
parent e79d8e8e52
commit 045f3965ec
5 changed files with 51 additions and 24 deletions
+2 -2
View File
@@ -21,7 +21,7 @@ import {
} from '#/state/queries/preferences/types'
import {createQueryKey} from '#/state/queries/util'
import {useAgent} from '#/state/session'
import {saveLabelers} from '#/state/session/agent-config'
import {saveLabelers} from '#/state/session/moderation'
import {useAgeAssurance} from '#/ageAssurance'
import {makeAgeRestrictedModerationPrefs} from '#/ageAssurance/util'
import {useAnalytics} from '#/analytics'
@@ -53,7 +53,7 @@ export function usePreferencesQuery() {
const res = await agent.getPreferences()
// save to local storage to ensure there are labels on initial requests
void saveLabelers(
saveLabelers(
agent.did,
res.moderationPrefs.labelers.map(l => l.did),
)