π₯ π₯ π₯ A Free & Self-hostable Airtable Alternative
TypeScript airtableairtable-alternativeautomatic-apihacktoberfestlow-codeno-codeno-code-databaseno-code-platformpostgresqlrest-apirestful-apispreadsheetsqliteswagger
fix: redirect to base home on invalid view Id or dashboardId
DarkPhoenix2704eb9371a13e9e
diff --git a/packages/nc-gui/components/smartsheet/Gallery.vue b/packages/nc-gui/components/smartsheet/Gallery.vueindex 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 = trueawait nextTick(() => {@@ -329,8 +326,6 @@ watch(isViewDataLoading.value = truetry {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.vueindex 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<TableType | undefined>(() => {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,+ })+ }+})</script><template>diff --git a/packages/nc-gui/composables/useGalleryViewData.ts b/packages/nc-gui/composables/useGalleryViewData.tsindex 113c889b01..b04a2e2552 100644--- a/packages/nc-gui/composables/useGalleryViewData.ts+++ b/packages/nc-gui/composables/useGalleryViewData.ts@@ -8,8 +8,6 @@ export function useGalleryViewData() {const isPublic = inject(IsPublicInj, ref(false))- const { $api } = useNuxtApp()-const tablesStore = useTablesStore()const { activeTable } = storeToRefs(tablesStore)@@ -18,7 +16,7 @@ export function useGalleryViewData(const meta = computed(() => _meta.value || activeTable.value)- const viewData = ref<GalleryType | undefined>()+ const viewData = computed(() => (isPublic.value ? (sharedView.value?.view as GalleryType) : viewMeta.value?.view))const {cachedRows,@@ -42,17 +40,11 @@ export function useGalleryViewData(isPublic,})- async function loadGalleryData() {- if (!viewMeta?.value?.id) return- viewData.value = isPublic.value ? (sharedView.value?.view as GalleryType) : await $api.dbView.galleryRead(viewMeta.value.id)- }-return {cachedRows,deleteRow,loadData,navigateToSiblingRow,- loadGalleryData,viewData,totalRows,clearCache,diff --git a/packages/nc-gui/composables/useViewData.ts b/packages/nc-gui/composables/useViewData.tsindex 8cbfc15f2e..56c5d412d0 100644--- a/packages/nc-gui/composables/useViewData.ts+++ b/packages/nc-gui/composables/useViewData.ts@@ -311,13 +311,6 @@ export function useViewData(}}- async function loadGalleryData() {- if (!viewMeta?.value?.id) return- galleryData.value = isPublic.value- ? (sharedView.value?.view as GalleryType)- : await $api.dbView.galleryRead(viewMeta.value.id)- }-async function changePage(page: number) {paginationData.value.page = pageawait loadData(@@ -483,7 +476,6 @@ export function useViewData(syncCount,syncPagination,galleryData,- loadGalleryData,loadFormView,formColumnData,formViewData,