Add local storage effect to save sidebar state (#13591)
Add local storage effect to keep the behavior across sessions
This commit is contained in:
@@ -1,9 +1,11 @@
|
|||||||
import { atom } from 'recoil';
|
import { atom } from 'recoil';
|
||||||
import { MOBILE_VIEWPORT } from 'twenty-ui/theme';
|
import { MOBILE_VIEWPORT } from 'twenty-ui/theme';
|
||||||
|
import { localStorageEffect } from '~/utils/recoil-effects';
|
||||||
|
|
||||||
const isMobile = window.innerWidth <= MOBILE_VIEWPORT;
|
const isMobile = window.innerWidth <= MOBILE_VIEWPORT;
|
||||||
|
|
||||||
export const isNavigationDrawerExpandedState = atom({
|
export const isNavigationDrawerExpandedState = atom({
|
||||||
key: 'isNavigationDrawerExpanded',
|
key: 'isNavigationDrawerExpanded',
|
||||||
default: !isMobile,
|
default: !isMobile,
|
||||||
|
effects: [localStorageEffect()],
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user