webui: make diff UI update after data loads
Sometimes diff content would load quickly but the UI would stay stuck
showing 'Loading...' for many seconds until some external action
(like clicking in console) triggered a repaint.
Root cause: Lit wasn't automatically detecting that it needed to re-render
when the async loadDiffData() completed and this.loading changed from
true to false.
Fix: Explicitly call requestUpdate() to force a re-render after loading
completes, ensuring the UI immediately shows the loaded diff content.
Co-Authored-By: sketch <hello@sketch.dev>
Change-ID: s6ba963f401c89febk
diff --git a/webui/src/web-components/sketch-diff2-view.ts b/webui/src/web-components/sketch-diff2-view.ts
index 78b1da3..f524dd5 100644
--- a/webui/src/web-components/sketch-diff2-view.ts
+++ b/webui/src/web-components/sketch-diff2-view.ts
@@ -546,6 +546,9 @@
this.fileExpandStates.clear();
} finally {
this.loading = false;
+ // Request a re-render.
+ // Empirically, without this line, diffs are visibly slow to load.
+ this.requestUpdate();
}
}