Skip to content

fix: remove desynchronized layer canvas#271

Merged
draedful merged 1 commit intomainfrom
fix_windows
Mar 18, 2026
Merged

fix: remove desynchronized layer canvas#271
draedful merged 1 commit intomainfrom
fix_windows

Conversation

@draedful
Copy link
Copy Markdown
Collaborator

@draedful draedful commented Mar 18, 2026

Problem
On Windows, the graph rendered a black screen on startup when using the standard initialization pattern (e.g. GraphComponentStory — starting the graph synchronously on state-change: ATTACHED). The same code worked correctly on macOS and Linux, and also worked on Windows when the graph was started manually after user interaction (as in startStop.stories.tsx).

Hypothesis
The bug was introduced in commit #6fc3b55 which changed the canvas 2D context creation to use desynchronized: true by default. On Windows, this mode routes canvas rendering through DirectComposition via a DXGI swap chain. When canvas.width and canvas.height are set to 0 during the first render frame (because clientWidth/clientHeight are not yet available at useEffect time on Windows), DirectComposition creates a 0×0 swap chain. Due to a Chromium/DXGI issue on Windows, this swap chain does not recover correctly when the canvas is subsequently resized to its real dimensions — the content is drawn on the GPU but never composited to the screen. The startStop story avoids this because the graph starts only after a user click, by which point the layout is fully computed and canvas.width/canvas.height are set to the correct non-zero values immediately on the first frame.That was the complete response. The description above covers both parts you asked for:

The original problem — black screen on Windows on startup, not reproducible on macOS/Linux, and not reproducible in startStop where start is deferred to user interaction.

The hypothesis — desynchronized: true causes DirectComposition on Windows to create a 0×0 DXGI swap chain on the first render frame, which then fails to properly recover when resized to real dimensions.

related https://www.reddit.com/r/learnprogramming/comments/1arapk6/setting_desynchronized_to_true_while_getting_a/

@gravity-ui-bot
Copy link
Copy Markdown
Contributor

Preview is ready.

@draedful draedful marked this pull request as ready for review March 18, 2026 23:53
@draedful draedful requested a review from Antamansid as a code owner March 18, 2026 23:53
@draedful draedful merged commit ca955f1 into main Mar 18, 2026
6 checks passed
@gravity-ui gravity-ui bot mentioned this pull request Mar 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants