diff options
Diffstat (limited to 'src/state/preferences/external-embeds-prefs.tsx')
-rw-r--r-- | src/state/preferences/external-embeds-prefs.tsx | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/state/preferences/external-embeds-prefs.tsx b/src/state/preferences/external-embeds-prefs.tsx index 0f6385fe8..9ace5d940 100644 --- a/src/state/preferences/external-embeds-prefs.tsx +++ b/src/state/preferences/external-embeds-prefs.tsx @@ -1,9 +1,13 @@ import React from 'react' + import * as persisted from '#/state/persisted' import {EmbedPlayerSource} from 'lib/strings/embed-player' type StateContext = persisted.Schema['externalEmbeds'] -type SetContext = (source: EmbedPlayerSource, value: 'show' | 'hide') => void +type SetContext = ( + source: EmbedPlayerSource, + value: 'show' | 'hide' | undefined, +) => void const stateContext = React.createContext<StateContext>( persisted.defaults.externalEmbeds, @@ -14,7 +18,7 @@ export function Provider({children}: React.PropsWithChildren<{}>) { const [state, setState] = React.useState(persisted.get('externalEmbeds')) const setStateWrapped = React.useCallback( - (source: EmbedPlayerSource, value: 'show' | 'hide') => { + (source: EmbedPlayerSource, value: 'show' | 'hide' | undefined) => { setState(prev => { persisted.write('externalEmbeds', { ...prev, |