diff --git a/packages/nc-gui/components/smartsheet/Gallery.vue b/packages/nc-gui/components/smartsheet/Gallery.vue index 7a3e5b2ae2..1ee96aeb8e 100644 --- a/packages/nc-gui/components/smartsheet/Gallery.vue +++ b/packages/nc-gui/components/smartsheet/Gallery.vue @@ -35,7 +35,6 @@ provide(ReloadRowDataHookInj, reloadViewDataHook!) const { fetchChunk, - loadGalleryData, deleteRow, syncCount, navigateToSiblingRow, @@ -182,8 +181,6 @@ onBeforeUnmount(() => openNewRecordFormHook.off(openNewRecordFormHookHandler)) const reloadAttachments = ref(false) reloadViewMetaHook?.on(async () => { - await loadGalleryData() - reloadAttachments.value = true await nextTick(() => { @@ -329,8 +326,6 @@ watch( isViewDataLoading.value = true try { if (nextView?.type === ViewTypes.GALLERY) { - await loadGalleryData() - await syncCount() if (rowSlice.end === 0) { rowSlice.end = Math.min(100, totalRows.value) diff --git a/packages/nc-gui/components/tabs/Smartsheet.vue b/packages/nc-gui/components/tabs/Smartsheet.vue index ef7f11ee81..514faf7d58 100644 --- a/packages/nc-gui/components/tabs/Smartsheet.vue +++ b/packages/nc-gui/components/tabs/Smartsheet.vue @@ -18,7 +18,7 @@ const { isUIAllowed } = useRoles() const { metas, getMeta } = useMetas() -const { isMobileMode } = useGlobal() +const { isMobileMode, ncNavigateTo } = useGlobal() const route = useRoute() @@ -30,7 +30,11 @@ const meta = computed(() => { const { handleSidebarOpenOnMobileForNonViews } = useConfigStore() const { activeTableId } = storeToRefs(useTablesStore()) -const { activeView, openedViewsTab, activeViewTitleOrId } = storeToRefs(useViewsStore()) +const { activeProjectId } = storeToRefs(useBases()) + +const { activeWorkspaceId } = storeToRefs(useWorkspace()) + +const { activeView, openedViewsTab, activeViewTitleOrId, isViewsLoading } = storeToRefs(useViewsStore()) const { isGallery, isGrid, isForm, isKanban, isLocked, isMap, isCalendar, xWhere, eventBus } = useProvideSmartsheetStore( activeView, meta, @@ -224,6 +228,26 @@ const onReady = () => { }, 300) } } + +onMounted(async () => { + await until(isViewsLoading).toBe(false) + + if (!activeView.value) { + ncNavigateTo({ + workspaceId: activeWorkspaceId.value, + baseId: activeProjectId.value, + }) + } +}) + +watch([() => isViewsLoading.value, () => activeView.value], ([isLoading, _]) => { + if (!isLoading && !activeView.value) { + ncNavigateTo({ + workspaceId: activeWorkspaceId.value, + baseId: activeProjectId.value, + }) + } +})