Skip to content

fix: Live preview tests fails intermitantly esp in chrome browser builds#2668

Merged
abose merged 2 commits intomainfrom
z
Feb 12, 2026
Merged

fix: Live preview tests fails intermitantly esp in chrome browser builds#2668
abose merged 2 commits intomainfrom
z

Conversation

@abose
Copy link
Member

@abose abose commented Feb 12, 2026

fix: race condition in _loadPreview causing stale iframe overwrites

_togglePinUrl() calls _loadPreview(true) without awaiting it, so multiple concurrent _loadPreview calls can interleave. When the earlier call's getPreviewDetails() involves slow async I/O (e.g. FileSystem.existsAsync for SVG files on Chrome's virtual filesystem), a newer _loadPreview call can complete first and set the correct iframe URL. The older call then resumes with stale previewDetails and overwrites the iframe, breaking the live preview.

Add a generation counter so that after the await, a _loadPreview call detects if a newer call was initiated and bails out, preventing stale results from clobbering the current preview state.

abose and others added 2 commits February 12, 2026 10:36
_togglePinUrl() calls _loadPreview(true) without awaiting it, so
multiple concurrent _loadPreview calls can interleave. When the
earlier call's getPreviewDetails() involves slow async I/O (e.g.
FileSystem.existsAsync for SVG files on Chrome's virtual filesystem),
a newer _loadPreview call can complete first and set the correct
iframe URL. The older call then resumes with stale previewDetails and
overwrites the iframe, breaking the live preview.

Add a generation counter so that after the await, a _loadPreview call
detects if a newer call was initiated and bails out, preventing stale
results from clobbering the current preview state.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
… Mac Tauri

On Tauri/macOS, native file writes truncate before writing new content.
When awaitsFor polls read the keybinding JSON file between truncation
and write completion, JSON.parse fails on empty/partial content. Since
awaitsFor immediately rejects on any exception rather than retrying,
a single partial read kills the test.

Wrap all 6 JSON.parse(await _readKeyboardJson(...)) calls in try-catch
blocks so parse errors on mid-write reads return false, allowing
awaitsFor to retry on the next poll cycle instead of failing the test.
@sonarqubecloud
Copy link

@abose abose merged commit e112158 into main Feb 12, 2026
20 of 21 checks passed
@abose abose deleted the z branch February 12, 2026 06:51
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.

1 participant