Don't use a persisted setting when switching users; ref #3021
This commit is contained in:
parent
3053a896f4
commit
914ee65ded
2 changed files with 5 additions and 4 deletions
|
@ -1,6 +1,6 @@
|
|||
import { Dispatch, SetStateAction, useEffect, useState } from 'react';
|
||||
|
||||
export function usePersistedState<S = undefined> (key: string, defaultValue: S): [S | undefined, Dispatch<SetStateAction<S | undefined>>] {
|
||||
export function usePersistedState<S = undefined> (key: string, defaultValue: S): [ S | undefined, Dispatch<SetStateAction<S | undefined>> ] {
|
||||
const [ state, setState ] = useState(
|
||||
() => {
|
||||
try {
|
||||
|
@ -12,7 +12,7 @@ export function usePersistedState<S = undefined> (key: string, defaultValue: S):
|
|||
|
||||
return defaultValue;
|
||||
}
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue