Fix numerous test fails because of unitialized user settings scope on the test environment

GitOrigin-RevId: a27454285b0c89c6abef560f05c52d35f81fa570
This commit is contained in:
M Fahru 2022-12-28 10:17:44 -07:00 committed by Copybot
parent 56395d9a95
commit 5597736057
2 changed files with 21 additions and 21 deletions

View file

@ -23,25 +23,25 @@ type ProjectSettingsContextValue = {
setRootDocId: (rootDocId: string) => void
spellCheckLanguage?: string
setSpellCheckLanguage: (spellCheckLanguage: string) => void
autoComplete: boolean
autoComplete?: boolean
setAutoComplete: (autoComplete: boolean) => void
autoPairDelimiters: boolean
autoPairDelimiters?: boolean
setAutoPairDelimiters: (autoPairDelimiters: boolean) => void
syntaxValidation: boolean
syntaxValidation?: boolean
setSyntaxValidation: (syntaxValidation: boolean) => void
mode: Keybindings
mode?: Keybindings
setMode: (mode: Keybindings) => void
editorTheme: string
editorTheme?: string
setEditorTheme: (editorTheme: string) => void
overallTheme: OverallTheme
overallTheme?: OverallTheme
setOverallTheme: (overallTheme: OverallTheme) => void
fontSize: string
fontSize?: string
setFontSize: (fontSize: string) => void
fontFamily: FontFamily
fontFamily?: FontFamily
setFontFamily: (fontFamily: FontFamily) => void
lineHeight: LineHeight
lineHeight?: LineHeight
setLineHeight: (lineHeight: LineHeight) => void
pdfViewer: PdfViewer
pdfViewer?: PdfViewer
setPdfViewer: (pdfViewer: PdfViewer) => void
}

View file

@ -11,7 +11,7 @@ import type { UserSettingsScope } from '../utils/api'
export default function useUserWideSettings() {
const saveUserSettings = useSaveUserSettings()
const [userSettings] = useScopeValue<UserSettingsScope>('settings', true)
const [userSettings] = useScopeValue<UserSettingsScope | undefined>('settings', true)
const setOverallTheme = useSetOverallTheme()
const setAutoComplete = useCallback(
@ -78,25 +78,25 @@ export default function useUserWideSettings() {
)
return {
autoComplete: userSettings.autoComplete,
autoComplete: userSettings?.autoComplete,
setAutoComplete,
autoPairDelimiters: userSettings.autoPairDelimiters,
autoPairDelimiters: userSettings?.autoPairDelimiters,
setAutoPairDelimiters,
syntaxValidation: userSettings.syntaxValidation,
syntaxValidation: userSettings?.syntaxValidation,
setSyntaxValidation,
editorTheme: userSettings.editorTheme,
editorTheme: userSettings?.editorTheme,
setEditorTheme,
overallTheme: userSettings.overallTheme,
overallTheme: userSettings?.overallTheme,
setOverallTheme,
mode: userSettings.mode,
mode: userSettings?.mode,
setMode,
fontSize: userSettings.fontSize,
fontSize: userSettings?.fontSize,
setFontSize,
fontFamily: userSettings.fontFamily,
fontFamily: userSettings?.fontFamily,
setFontFamily,
lineHeight: userSettings.lineHeight,
lineHeight: userSettings?.lineHeight,
setLineHeight,
pdfViewer: userSettings.pdfViewer,
pdfViewer: userSettings?.pdfViewer,
setPdfViewer,
}
}