File tree Expand file tree Collapse file tree 3 files changed +10
-9
lines changed
Expand file tree Collapse file tree 3 files changed +10
-9
lines changed Original file line number Diff line number Diff line change @@ -2,9 +2,10 @@ import { defaults } from '../hooks/settings';
22import { formatSearch } from './format-search' ;
33
44export const validateInput = (
5- params : URLSearchParams
5+ params : URLSearchParams ,
6+ settings : TSMLReactConfig
67) : TSMLReactConfig [ 'defaults' ] => {
7- const { defaults : defaultInput } = defaults ;
8+ const { defaults : defaultInput } = settings ;
89
910 const modeParam = params . get ( 'mode' ) ;
1011 const mode = isMode ( modeParam ) ? modeParam : defaultInput . mode ;
Original file line number Diff line number Diff line change 88import { useSearchParams } from 'react-router-dom' ;
99
1010import { validateInput } from '../helpers' ;
11- import { defaults } from './settings' ;
11+ import { defaults , useSettings } from './settings' ;
1212
1313const InputContext = createContext < {
1414 input : TSMLReactConfig [ 'defaults' ] ;
@@ -17,19 +17,19 @@ const InputContext = createContext<{
1717export const InputProvider = ( { children } : PropsWithChildren ) => {
1818 const [ searchParams ] = useSearchParams ( ) ;
1919
20+ const { settings } = useSettings ( ) ;
21+
2022 const [ input , setInput ] = useState < TSMLReactConfig [ 'defaults' ] > (
21- validateInput ( searchParams )
23+ validateInput ( searchParams , settings )
2224 ) ;
2325
2426 // detect input from URL search params
2527 useEffect ( ( ) => {
26- setInput ( validateInput ( searchParams ) ) ;
28+ setInput ( validateInput ( searchParams , settings ) ) ;
2729 } , [ searchParams ] ) ;
2830
2931 return (
30- < InputContext . Provider value = { { input } } >
31- { children }
32- </ InputContext . Provider >
32+ < InputContext . Provider value = { { input } } > { children } </ InputContext . Provider >
3333 ) ;
3434} ;
3535
You can’t perform that action at this time.
0 commit comments