diff --git a/src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/+layout.svelte b/src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/+layout.svelte
index 57e32165ba..c5a475a6ff 100644
--- a/src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/+layout.svelte
+++ b/src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/+layout.svelte
@@ -165,7 +165,8 @@
}
},
icon: IconPlus,
- group: 'rows'
+ group: 'rows',
+ disabled: !table || !$canWriteTables
},
{
label: 'Create column',
@@ -175,7 +176,7 @@
},
icon: IconPlus,
group: 'columns',
- disabled: !$canWriteTables
+ disabled: !table || !$canWriteTables
},
{
label: 'Go to rows',
@@ -257,7 +258,7 @@
},
icon: IconPlus,
group: 'indexes',
- disabled: !$canWriteTables
+ disabled: !table || !$canWriteTables
}
]);
@@ -385,7 +386,16 @@
{table?.name ?? 'Table'} - Appwrite
-
+{#if table}
+
+{:else}
+
+ Table deleted or not found
+
+ The table you're looking for no longer exists or could not be found.
+
+
+{/if}
{
const { database, project } = await parent();
@@ -15,10 +16,18 @@ export const load: LayoutLoad = async ({ params, depends, parent }) => {
toDatabaseType(database.type)
);
- const table = await databaseSdk.getEntity({
- databaseId: params.database,
- entityId: params.table
- });
+ let table = null;
+
+ try {
+ table = await databaseSdk.getEntity({
+ databaseId: params.database,
+ entityId: params.table
+ });
+ } catch (e) {
+ if (!(e instanceof AppwriteException) || e.code !== 404) {
+ throw e;
+ }
+ }
return {
table,
diff --git a/src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/+page.ts b/src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/+page.ts
index a584f612b3..419efc4811 100644
--- a/src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/+page.ts
+++ b/src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/+page.ts
@@ -7,6 +7,22 @@ import { buildGridQueries, extractSortFromQueries, loadGridRows } from '$databas
export const load: PageLoad = async ({ params, depends, url, route, parent }) => {
const { table } = await parent();
+
+ if (!table) {
+ return {
+ offset: 0,
+ limit: SPREADSHEET_PAGE_LIMIT,
+ view: View.Grid,
+ query: '',
+ currentSort: { column: null, direction: 'default' },
+ parsedQueries: new Map(),
+ rows: {
+ total: 0,
+ rows: []
+ }
+ };
+ }
+
depends(Dependencies.ROWS);
const page = getPage(url);