Skip to content

Commit 033fcdf

Browse files
fix: re-trigger lineage render on webview:ready to close postMessage race (#1931)
When the lineage webview first mounts, the extension posts an initial `render` from `init()` before the React `window.addEventListener('message', ...)` in `LineageView.tsx` has been registered. VS Code's webview API queues postMessages until the iframe's HTML is ready, not until React's effects have run, so the initial render can be silently dropped. The webview already attempts a recovery via `executeRequestInAsync('init', {})` once its listener is registered, and PR #1857 added an `eventMapChanged` re-render path. Both close *some* races, but neither covers the case where the recovery `init` is delayed past where the user perceives the panel as broken (a known telemetry signal: `Lineage:getStartingNode` "No event found" fires 811 times across 84 distinct machines in the last 7 days, with the top offender hitting it 93 times in a 35-minute single session). This adds an explicit `onWebviewReady` override on `NewLineagePanel` that re-runs `renderStartingNode()` once the framework-level `webview:ready` ack arrives. By that point both `useListeners` (AppProvider) and `LineageView`'s own message listener have registered, so the second render lands. The webview-driven `init` recovery and the manifest-change re-render remain in place as additional belts. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent e17edf5 commit 033fcdf

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

src/webview_provider/newLineagePanel.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,11 @@ export class NewLineagePanel
9292
this.renderStartingNode();
9393
}
9494

95+
protected onWebviewReady() {
96+
super.onWebviewReady();
97+
this.renderStartingNode();
98+
}
99+
95100
changedActiveColorTheme() {
96101
if (!this._panel) {
97102
return;

0 commit comments

Comments
 (0)