Skip to content

Commit 022e4ab

Browse files
thjaeckleclaude
andcommitted
Fix Diff and sub-diff views not clearing on thing deselection
When deselecting a thing, the Diff tab showed unformatted residual content and the Attributes/Features Diff sub-tabs retained stale data. Now destroyDiff() clears the container DOM, onThingChanged(null) resets all state variables and destroys sub-diffs, and SubDiff.destroy() clears its container and pending content. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 8bc8537 commit 022e4ab

2 files changed

Lines changed: 15 additions & 0 deletions

File tree

ui/modules/things/subDiff.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,5 +111,10 @@ export function SubDiff(targetTab, title: string) {
111111
diffInstance.destroy();
112112
diffInstance = null;
113113
}
114+
pendingLeft = null;
115+
pendingRight = null;
116+
if (container) {
117+
container.textContent = '';
118+
}
114119
}
115120
}

ui/modules/things/thingsDiff.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,16 @@ export function ThingsDiff(targetTab) {
109109
const onThingChanged = (thing, isNewThingId: boolean) => {
110110
if (!thing) {
111111
currentThingId = null;
112+
currentMinRevision = 1;
112113
currentMaxRevision = 1;
114+
lastLeftJson = null;
115+
lastRightJson = null;
116+
viewDirty = false;
113117
cancelActiveProbe();
114118
destroyDiff();
119+
for (const { subDiff } of subDiffs) {
120+
subDiff.destroy();
121+
}
115122
return;
116123
}
117124

@@ -170,6 +177,9 @@ export function ThingsDiff(targetTab) {
170177
diffInstance = null;
171178
}
172179
overviewSvg = null;
180+
if (dom.diffContainer) {
181+
dom.diffContainer.textContent = '';
182+
}
173183
}
174184

175185
function onTabActivated() {

0 commit comments

Comments
 (0)