Conversation
_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.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



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.