Skip to content

Commit

Permalink
Use default highlight colors in cache init if sync settings empty
Browse files Browse the repository at this point in the history
- Another high hit sentry error, presumably from this code assuming highlight colors always set in sync settings when they're not
  • Loading branch information
poltak committed Jun 14, 2024
1 parent bf558bc commit 395bff4
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/annotations/cache/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import type { BackgroundModuleRemoteInterfaces } from 'src/background-script/typ
import type { SharedListMetadata } from 'src/content-sharing/background/types'
import { DEFAULT_KEY } from '@worldbrain/memex-common/lib/utils/item-ordering'
import { createSyncSettingsStore } from 'src/sync-settings/util'
import { HIGHLIGHT_COLORS_DEFAULT } from '@worldbrain/memex-common/lib/common-ui/components/highlightColorPicker/constants'

export const reshapeAnnotationForCache = (
annot: Annotation & {
Expand Down Expand Up @@ -259,9 +260,9 @@ export async function hydrateCacheForPageAnnotations(
const syncSettingsStore = createSyncSettingsStore({
syncSettingsBG: args.bgModules.syncSettings,
})
const highlightColors = await syncSettingsStore.highlightColors.get(
'highlightColors',
)
const highlightColors =
(await syncSettingsStore.highlightColors.get('highlightColors')) ??
HIGHLIGHT_COLORS_DEFAULT
args.cache.setHighlightColorDictionary(highlightColors)

args.cache.setAnnotations(
Expand Down

0 comments on commit 395bff4

Please sign in to comment.