@@ -12,14 +12,14 @@ const defaultState: Record<string, string> = {
1212 timer : '0'
1313}
1414
15- export const RegisterHashWatcher = memo ( ( ) => {
15+ const RegisterHashWatcher = memo ( ( ) => {
1616 const set = useSetAtom ( userConfigStateBulk )
1717 const params = useHashChangedExternally ( )
1818 set ( { ...defaultState , ...params } )
1919 return < > </ >
2020} )
2121
22- export const RegisterHashUpdater = memo ( ( ) => {
22+ const RegisterHashUpdater = memo ( ( ) => {
2323 const obj = useAtomValue ( userConfigStateBulk )
2424 setHashFromObject ( { ...defaultState , ...obj } )
2525 return < > </ >
@@ -41,11 +41,11 @@ export const userConfigState = atomFamily((variable: string) =>
4141 ( get ) => get ( userConfigStateBulk ) [ variable ] ,
4242 ( get , set , value ?: string ) => {
4343 const was = get ( userConfigStateBulk )
44- if ( value === undefined ) {
44+ if ( value ) {
45+ set ( userConfigStateBulk , { ...was , [ variable ] : value } )
46+ } else {
4547 const { [ variable ] : _removedValue , ...without } = was
4648 set ( userConfigStateBulk , without )
47- } else {
48- set ( userConfigStateBulk , { ...was , [ variable ] : value } )
4949 }
5050 }
5151 )
0 commit comments