From 7a46000dadb47e8054d69ce3169fc5d9ae563f30 Mon Sep 17 00:00:00 2001 From: Louis Ouellet Date: Wed, 22 Oct 2025 08:39:27 -0400 Subject: [PATCH 1/2] General: Version bumped to v0.0.47 --- VERSION | 2 +- info.cfg | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/VERSION b/VERSION index 5bc7386..d6eb32c 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -v0.0.46 +v0.0.47 diff --git a/info.cfg b/info.cfg index 22e66cb..fa74ff5 100644 --- a/info.cfg +++ b/info.cfg @@ -5,7 +5,7 @@ "author": "LaswitchTech", "email": "support@laswitchtech.com", "date": "2025-10-22", - "version": "v0.0.46", + "version": "v0.0.47", "tags": "tasks, management, workflowhub", "description": "Tasks Plugin for the LaswitchTech Core Framework.", "repository": "https://github.com/LaswitchTech/core-plugin-tasks", From 89dec567baaff8bfc28ec843b30cbf42b53587f9 Mon Sep 17 00:00:00 2001 From: Louis Ouellet Date: Wed, 22 Oct 2025 11:32:40 -0400 Subject: [PATCH 2/2] BUGFIX: When updating tables, we should remove rows that no longer exists. --- library.js | 36 ++++++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/library.js b/library.js index 25d6897..a6767f3 100644 --- a/library.js +++ b/library.js @@ -1325,22 +1325,34 @@ builder.add('widgets','tasks', class extends builder.ComponentClass { // Set Self const self = this; - // Check if records are provided - if(records !== null && Object.entries(records).length > 0){ - - // Loop through the records + // Create a loader function + const loader = function(records){ for(const [key, record] of Object.entries(records)){ - this.add(record); + self.add(record); } - return this; + self.datatable().rows().every(function(rowIdx, tableLoop, rowLoop){ + if(typeof records[this.data()['id']] === 'undefined'){ + self.datatable().row(rowIdx).remove(); + } + }); + return self; + }; + + // Check if records are provided + if(records !== null && Object.entries(records).length > 0){ + return loader(records); } - // Retrieve Followups - API.endpoint('/tasks/fetchAll').data({conditions: this._properties.conditions}).execute(function(response){ - for(const [key, record] of Object.entries(response.records)){ - self.add(record); - } - }); + // Retrieve Records + if(Array.isArray(this._properties.conditions)){ + API.endpoint('/tasks/fetchAll').data({conditions: self._properties.conditions}).execute(function(response){ + return loader(response.records); + }); + } else { + API.endpoint('/tasks/fetchAll').execute(function(response){ + return loader(response.records); + }); + } return this; }