From 5597736057826d921211b4015cd991812f21bbc6 Mon Sep 17 00:00:00 2001 From: M Fahru Date: Wed, 28 Dec 2022 10:17:44 -0700 Subject: [PATCH] Fix numerous test fails because of unitialized user settings scope on the test environment GitOrigin-RevId: a27454285b0c89c6abef560f05c52d35f81fa570 --- .../context/project-settings-context.tsx | 20 ++++++++--------- .../hooks/use-user-wide-settings.tsx | 22 +++++++++---------- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/services/web/frontend/js/features/editor-left-menu/context/project-settings-context.tsx b/services/web/frontend/js/features/editor-left-menu/context/project-settings-context.tsx index 012c2a1980..5a2a5ce7ac 100644 --- a/services/web/frontend/js/features/editor-left-menu/context/project-settings-context.tsx +++ b/services/web/frontend/js/features/editor-left-menu/context/project-settings-context.tsx @@ -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 } diff --git a/services/web/frontend/js/features/editor-left-menu/hooks/use-user-wide-settings.tsx b/services/web/frontend/js/features/editor-left-menu/hooks/use-user-wide-settings.tsx index 40b20eb533..42543cc2fa 100644 --- a/services/web/frontend/js/features/editor-left-menu/hooks/use-user-wide-settings.tsx +++ b/services/web/frontend/js/features/editor-left-menu/hooks/use-user-wide-settings.tsx @@ -11,7 +11,7 @@ import type { UserSettingsScope } from '../utils/api' export default function useUserWideSettings() { const saveUserSettings = useSaveUserSettings() - const [userSettings] = useScopeValue('settings', true) + const [userSettings] = useScopeValue('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, } }