diff --git a/packages/nc-gui/components/smartsheet/sidebar/index.vue b/packages/nc-gui/components/smartsheet/sidebar/index.vue index 137fce1f75..4ff2d36f6b 100644 --- a/packages/nc-gui/components/smartsheet/sidebar/index.vue +++ b/packages/nc-gui/components/smartsheet/sidebar/index.vue @@ -34,7 +34,7 @@ const { $e } = useNuxtApp() provide(ViewListInj, views) /** Sidebar visible */ -const { isOpen } = useSidebar('nc-right-sidebar', { isOpen: true }) +const { isOpen } = useSidebar('nc-right-sidebar') const sidebarCollapsed = computed(() => !isOpen.value) @@ -108,6 +108,7 @@ function onCreate(view: ViewType) { class="relative shadow-md h-full" theme="light" > + {{ isOpen }} { } if (props.useStorage) { - const storage = toRefs(useStorage(id, { isOpen, hasSidebar }, localStorage, { mergeDefaults: true }).value) + const storage = toRefs(useStorage(id, { isOpen, hasSidebar }, localStorage).value) + isOpen.value = storage.isOpen.value + hasSidebar.value = storage.hasSidebar.value + syncRef(isOpen, storage.isOpen) syncRef(hasSidebar, storage.hasSidebar) } @@ -58,7 +61,7 @@ const createSidebar = (id: string, props: UseSidebarProps = {}) => { const leftSidebar = createSharedComposable(() => createSidebar('leftSidebar')) -const rightSidebar = createSharedComposable(() => createSidebar('rightSidebar', { useStorage: true })) +const rightSidebar = createSharedComposable(() => createSidebar('rightSidebar', { useStorage: true, isOpen: true })) export const useSidebar = (id: string, props: UseSidebarProps = {}) => { const sidebar = id.includes('left') ? leftSidebar() : rightSidebar()