fix: start playback from selected page and install key monitor in pin…#44
Merged
fix: start playback from selected page and install key monitor in pin…#44
Conversation
…ned mode Two bugs fixed: 1. Clicking a page in the sidebar then pressing Play always started from page 1 instead of the selected page. Root cause: the `sidebarSelection` setter wrapped the `currentPageIndex` update in `DispatchQueue.main.async`, deferring it asynchronously. Since SwiftUI binding setters are already called on the main thread, this wrapper was unnecessary and caused `run()` to read the stale value (0) before the update applied. Fix: remove the async dispatch so `currentPageIndex` is updated synchronously on selection. 2. `showPinned()` was the only display mode not calling `installKeyMonitor()`, so the ESC key did not work to dismiss the overlay in pinned mode. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
…ned mode
Two bugs fixed:
Clicking a page in the sidebar then pressing Play always started from page 1 instead of the selected page. Root cause: the
sidebarSelectionsetter wrapped thecurrentPageIndexupdate inDispatchQueue.main.async, deferring it asynchronously. Since SwiftUI binding setters are already called on the main thread, this wrapper was unnecessary and causedrun()to read the stale value (0) before the update applied. Fix: remove the async dispatch socurrentPageIndexis updated synchronously on selection.showPinned()was the only display mode not callinginstallKeyMonitor(), so the ESC key did not work to dismiss the overlay in pinned mode.