From 6af9a7e3602bb6d9afc6618e297521f55de9d1e0 Mon Sep 17 00:00:00 2001 From: jaydeep-pipaliya <71074587+jaydeep-pipaliya@users.noreply.github.com> Date: Wed, 1 Apr 2026 16:48:05 +0530 Subject: [PATCH] fix: prevent TypeError when updating relationship attribute The edit dialog crashed with an uncaught TypeError when clicking "Update" on a relationship attribute because the reactive title statement accessed option.name without checking if option was defined. The submit function also called option.update() without a null guard. Add null checks for option in both the title derivation and the submit function to prevent the crash and show a proper error message. Fix appwrite/appwrite#9951 --- .../database-[database]/table-[table]/columns/edit.svelte | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/columns/edit.svelte b/src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/columns/edit.svelte index 72db9ba820..05c612c804 100644 --- a/src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/columns/edit.svelte +++ b/src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/columns/edit.svelte @@ -53,6 +53,9 @@ export async function submit() { try { + if (!option?.update) { + throw new Error('Unsupported column type'); + } await option.update(databaseId, tableId, selectedColumn, originalKey); await invalidate(Dependencies.TABLE); @@ -103,7 +106,7 @@ // TODO: @itznotabug - runes? $: onShow(showEdit); - $: title = `Update ${columnOptions.find((v) => v.name === option.name)?.sentenceName ?? ''} column`; + $: title = `Update ${option ? (columnOptions.find((v) => v.name === option.name)?.sentenceName ?? '') : ''} column`; function onShow(show: boolean) { if (show) {