From f60b96fa0933415d078cf59bfaf69f9b5e724cac Mon Sep 17 00:00:00 2001 From: Christopher Schwarz Date: Sat, 9 May 2026 19:06:35 +0200 Subject: [PATCH 1/2] fix: use schema primary key in inline edit handlers (#44) handleUpdate and handleBooleanToggle in EditableCellRelational.vue detected the primary key by name pattern matching (key === 'id' || key.endsWith('_id')), which produced no result on collections whose primary key uses a different name (code, slug, uuid, sku, ...). The emit was skipped silently and the inline edit never reached the database. Both handlers now read the primary key field name from the primaryKeyField computed property, which the parent component sources from the Directus schema via useCollection. This also closes a latent risk: when an item carried both the real primary key and an unrelated field named id or ending in _id, the previous heuristic could pick the wrong column and dispatch the PATCH against an unrelated record. --- src/components/EditableCellRelational.vue | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/components/EditableCellRelational.vue b/src/components/EditableCellRelational.vue index d51888f..f3ff997 100644 --- a/src/components/EditableCellRelational.vue +++ b/src/components/EditableCellRelational.vue @@ -610,13 +610,13 @@ function renderTemplate(value: any, template: string): string { } function handleUpdate(value: any) { - const primaryKey = Object.keys(props.item).find((key) => key === 'id' || key.endsWith('_id')); + const itemId = props.item?.[primaryKeyField.value]; - if (primaryKey) { + if (itemId !== undefined && itemId !== null) { // Check if this is a full translations update if (typeof value === 'object' && value?.isFullTranslations) { // Handle full translations update from interface-translations - emit('update', props.item[primaryKey], 'translations', { + emit('update', itemId, 'translations', { isFullTranslations: true, translations: value.translations, }); @@ -631,17 +631,17 @@ function handleUpdate(value: any) { language: fieldLanguage.value, // Use language from field key or selected isTranslation: true, }; - emit('update', props.item[primaryKey], props.fieldKey, translationUpdate); + emit('update', itemId, props.fieldKey, translationUpdate); } else { - emit('update', props.item[primaryKey], props.fieldKey, value); + emit('update', itemId, props.fieldKey, value); } } } function handleBooleanToggle(value: boolean) { - const primaryKey = Object.keys(props.item).find((key) => key === 'id' || key.endsWith('_id')); - if (primaryKey) { - emit('update', props.item[primaryKey], props.fieldKey, value); + const itemId = props.item?.[primaryKeyField.value]; + if (itemId !== undefined && itemId !== null) { + emit('update', itemId, props.fieldKey, value); } } From f7b131557a3ef1ab9774a460281da38934438961 Mon Sep 17 00:00:00 2001 From: Christopher Schwarz Date: Sat, 9 May 2026 19:06:40 +0200 Subject: [PATCH 2/2] chore: bump version to 0.3.2 for hotfix --- CHANGELOG.md | 16 +++++++++++++++- package.json | 2 +- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5768dc1..1f6573f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,21 @@ All notable changes to the Super Layout Table Extension will be documented in th The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [0.3.1] - 2026-05-09 +## [0.3.2] - 2026-05-09 + +### Fixed +- **Inline editing silently failing for collections with non-`id` primary key + (Issue #44).** `handleUpdate` and `handleBooleanToggle` in + `EditableCellRelational.vue` were detecting the primary key by name pattern + matching (`key === 'id' || key.endsWith('_id')`), which produced no result on + collections whose primary key uses a different name (`code`, `slug`, `uuid`, + `sku`, …). Both functions now read the primary key field name from the + `primaryKeyField` computed property, which is sourced from the Directus + schema via the parent component. The previous heuristic could also have + selected an unrelated foreign-key column ending in `_id` and dispatched the + PATCH against the wrong record; that misdirection is no longer possible. + + ### Changed - Bumped 21 development dependencies to their latest patch versions within diff --git a/package.json b/package.json index cd3161a..b01d7db 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "directus-extension-super-table", - "version": "0.3.1", + "version": "0.3.2", "description": "A powerful and feature-rich table layout extension for Directus 11+ with inline editing, quick filters, and manual sorting", "keywords": [ "directus",