From 2f925e008f437be6be4ba9a996df8dde35142033 Mon Sep 17 00:00:00 2001 From: braks <78412429+bcakmakoglu@users.noreply.github.com> Date: Tue, 27 Sep 2022 09:44:03 +0200 Subject: [PATCH] fix(nc-gui): right sidebar state not restored --- packages/nc-gui/components/smartsheet/sidebar/index.vue | 3 ++- packages/nc-gui/components/tabs/Smartsheet.vue | 3 --- packages/nc-gui/composables/useSidebar/index.ts | 7 +++++-- 3 files changed, 7 insertions(+), 6 deletions(-) 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()