Skip to content

Commit 395bff4

Browse files
committed
Use default highlight colors in cache init if sync settings empty
- Another high hit sentry error, presumably from this code assuming highlight colors always set in sync settings when they're not
1 parent bf558bc commit 395bff4

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/annotations/cache/utils.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import type { BackgroundModuleRemoteInterfaces } from 'src/background-script/typ
2424
import type { SharedListMetadata } from 'src/content-sharing/background/types'
2525
import { DEFAULT_KEY } from '@worldbrain/memex-common/lib/utils/item-ordering'
2626
import { createSyncSettingsStore } from 'src/sync-settings/util'
27+
import { HIGHLIGHT_COLORS_DEFAULT } from '@worldbrain/memex-common/lib/common-ui/components/highlightColorPicker/constants'
2728

2829
export const reshapeAnnotationForCache = (
2930
annot: Annotation & {
@@ -259,9 +260,9 @@ export async function hydrateCacheForPageAnnotations(
259260
const syncSettingsStore = createSyncSettingsStore({
260261
syncSettingsBG: args.bgModules.syncSettings,
261262
})
262-
const highlightColors = await syncSettingsStore.highlightColors.get(
263-
'highlightColors',
264-
)
263+
const highlightColors =
264+
(await syncSettingsStore.highlightColors.get('highlightColors')) ??
265+
HIGHLIGHT_COLORS_DEFAULT
265266
args.cache.setHighlightColorDictionary(highlightColors)
266267

267268
args.cache.setAnnotations(

0 commit comments

Comments
 (0)