fix(player): open and reveal the PodNotes view from "Play with PodNotes" (#84)#198
Merged
Merged
Conversation
…s play (#84) Selecting 'Play with PodNotes' on an audio file set the currentEpisode and viewState stores but never opened or revealed the PodNotes view. When the view was closed or hidden in a collapsed sidebar nothing reacted, so the action silently did nothing — the file played to no visible player. This is the remaining half of issue #84; the no-supported-sources/blob playback half was fixed by #100. Open the right-sidebar view when no leaf exists and reveal it (which also surfaces a leaf hidden in a collapsed sidebar), mirroring the 'Show PodNotes' command and onLayoutReady. Keep the fix in getContextMenuHandler.ts; main.ts is untouched. Add unit tests covering the audio-only menu item, current-episode wiring, and both reveal paths (existing leaf vs. opening a new one).
Deploying podnotes with
|
| Latest commit: |
d024780
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://d1dc76bc.podnotes.pages.dev |
| Branch Preview URL: | https://chhoumann-84-play-with-podno.podnotes.pages.dev |
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.
Summary
Right-clicking an audio file and choosing Play with PodNotes now reliably opens and reveals the PodNotes player and starts playback, even when the PodNotes pane is closed or hidden in a collapsed sidebar.
Closes #84.
Background
Issue #84 (filed on Obsidian 1.4.1 / PodNotes 2.10.8) reported three symptoms: the action didn't open the player pane, didn't play, and showed a broken miniature with
DOMException: The element has no supported sources.The playback-source half was already fixed by #100 / #184, which replaced in-memory
blob:URLs withapp.vault.getResourcePath()and replaced an extension regex that matched every file with an explicit allow-list. I verified this on currentmasterin a real Obsidian instance (isolated e2e vault, real MP3): with the PodNotes pane already open, the file plays — validapp://src,audio.errorisnull,readyState1, realduration,currentTimeadvances.The remaining half still reproduced: with the pane closed, clicking Play with PodNotes did nothing visible — no leaf opened and nothing played:
Root cause: the handler set the
currentEpisodeandviewStatestores, but those only update an already-mounted Svelte view. When the view was closed (or hidden in a collapsed sidebar) nothing reacted, so the file played to no visible player — exactly the "doesn't open associated pane" symptom.The fix
In
src/getContextMenuHandler.ts, after setting the stores, ensure the player view is open and revealed via a smallrevealPodcastView(app)helper:VIEW_TYPEleaf when present, otherwise open one in the right sidebar withgetRightLeaf(false).setViewState(...);workspace.revealLeaf(leaf)— which also surfaces a leaf hidden inside a collapsed sidebar.This mirrors the existing Show PodNotes command and
onLayoutReadyinmain.ts. Setting the stores before opening the leaf is what lets a freshly mountedEpisodePlayerreadviewState = Player/currentEpisodeon first render and autoplay theapp://resource.main.tsis untouched — the change stays in the context-menu handler.Verification
Post-fix runtime repro (same isolated vault, pane closed before the click):
The already-open path is unchanged (it falls into the existing-leaf branch and just reveals), so there's no regression there.
Audio/test-tone.mp3) generated with ffmpeg, played from the file-explorer context menu.npm run obsidian:e2e), triggering the realfile-menuevent and invoking the captured item'sonClick.New tests
src/getContextMenuHandler.test.tscovers: the item is offered only for audio files, the current episode is wired with theapp://resource URL, and both reveal paths (reuse an existing leaf vs. open a new one).Gates (Node 22)
npm run lint,format:check,typecheck,build, andtest(457 tests) all pass.Release / migration impact
None. No settings, storage, API, or URI changes — purely the context-menu playback flow.