From d16d482120c460e7477aa515d3ce7badb6ae16f1 Mon Sep 17 00:00:00 2001 From: Juergen Kunz Date: Sun, 21 Dec 2025 18:30:41 +0000 Subject: [PATCH] fix(wcc-properties): Use LitElement.updated to recreate properties only when selectedItem changes and handle errors; remove custom scheduleUpdate implementation --- changelog.md | 8 ++++++++ ts_web/00_commitinfo_data.ts | 2 +- ts_web/elements/wcc-properties.ts | 18 +++++++++--------- 3 files changed, 18 insertions(+), 10 deletions(-) diff --git a/changelog.md b/changelog.md index 123c0f0..fbd87f5 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,13 @@ # Changelog +## 2025-12-21 - 3.1.2 - fix(wcc-properties) +Use LitElement.updated to recreate properties only when selectedItem changes and handle errors; remove custom scheduleUpdate implementation + +- Replaced public async scheduleUpdate() with protected updated(changedProperties) lifecycle method +- Call super.updated(...) and only recreate properties when selectedItem changed to avoid unnecessary work +- Preserve error handling and clear propertyContent on failure +- Removed explicit super.scheduleUpdate() call to rely on LitElement's update lifecycle + ## 2025-12-21 - 3.1.1 - fix(wcc-properties) Improve wcc-properties CSS to prevent grid overflow, properly size and center icon glyphs, and adjust right-side offset diff --git a/ts_web/00_commitinfo_data.ts b/ts_web/00_commitinfo_data.ts index f86a2a2..a72aa1c 100644 --- a/ts_web/00_commitinfo_data.ts +++ b/ts_web/00_commitinfo_data.ts @@ -3,6 +3,6 @@ */ export const commitinfo = { name: '@design.estate/dees-wcctools', - version: '3.1.1', + version: '3.1.2', description: 'A set of web component tools for creating element catalogues, enabling the structured development and documentation of custom elements and pages.' } diff --git a/ts_web/elements/wcc-properties.ts b/ts_web/elements/wcc-properties.ts index 8d45c70..c6987da 100644 --- a/ts_web/elements/wcc-properties.ts +++ b/ts_web/elements/wcc-properties.ts @@ -925,16 +925,16 @@ export class WccProperties extends DeesElement { this.dashboardRef.buildUrl(); } - public async scheduleUpdate() { - try { - await this.createProperties(); - } catch (error) { - console.error('Error creating properties:', error); - // Clear property content on error to show clean state - this.propertyContent = []; + protected updated(changedProperties: Map) { + super.updated(changedProperties); + + // Only recreate properties when selectedItem changes + if (changedProperties.has('selectedItem')) { + this.createProperties().catch(error => { + console.error('Error creating properties:', error); + this.propertyContent = []; + }); } - // Always call super.scheduleUpdate to ensure component updates - super.scheduleUpdate(); } public selectViewport(viewport: TEnvironment) {