Merge pull request #3047 from abhishekjakhar/feat/sidebar-lazy-state-initialization
feat: lazy state initialization of isPinned state of sidebar
This commit is contained in:
@@ -45,7 +45,9 @@ export const SidebarPinStateContext = createContext<SidebarPinStateContextType>(
|
||||
);
|
||||
|
||||
export const SidebarPage: FC<{}> = props => {
|
||||
const [isPinned, setIsPinned] = useState(LocalStorage.getSidebarPinState());
|
||||
const [isPinned, setIsPinned] = useState(() =>
|
||||
LocalStorage.getSidebarPinState(),
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
LocalStorage.setSidebarPinState(isPinned);
|
||||
|
||||
Reference in New Issue
Block a user