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 setRootDocId: (rootDocId: string) => void
spellCheckLanguage?: string spellCheckLanguage?: string
setSpellCheckLanguage: (spellCheckLanguage: string) => void setSpellCheckLanguage: (spellCheckLanguage: string) => void
autoComplete: boolean autoComplete?: boolean
setAutoComplete: (autoComplete: boolean) => void setAutoComplete: (autoComplete: boolean) => void
autoPairDelimiters: boolean autoPairDelimiters?: boolean
setAutoPairDelimiters: (autoPairDelimiters: boolean) => void setAutoPairDelimiters: (autoPairDelimiters: boolean) => void
syntaxValidation: boolean syntaxValidation?: boolean
setSyntaxValidation: (syntaxValidation: boolean) => void setSyntaxValidation: (syntaxValidation: boolean) => void
mode: Keybindings mode?: Keybindings
setMode: (mode: Keybindings) => void setMode: (mode: Keybindings) => void
editorTheme: string editorTheme?: string
setEditorTheme: (editorTheme: string) => void setEditorTheme: (editorTheme: string) => void
overallTheme: OverallTheme overallTheme?: OverallTheme
setOverallTheme: (overallTheme: OverallTheme) => void setOverallTheme: (overallTheme: OverallTheme) => void
fontSize: string fontSize?: string
setFontSize: (fontSize: string) => void setFontSize: (fontSize: string) => void
fontFamily: FontFamily fontFamily?: FontFamily
setFontFamily: (fontFamily: FontFamily) => void setFontFamily: (fontFamily: FontFamily) => void
lineHeight: LineHeight lineHeight?: LineHeight
setLineHeight: (lineHeight: LineHeight) => void setLineHeight: (lineHeight: LineHeight) => void
pdfViewer: PdfViewer pdfViewer?: PdfViewer
setPdfViewer: (pdfViewer: PdfViewer) => void setPdfViewer: (pdfViewer: PdfViewer) => void
} }

View file

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