Skip to content

fix(player): pass playerBarNavigationAction to sidebar playlist views - #439

Open
tsibog wants to merge 3 commits into
sozercan:mainfrom
tsibog:fix/playerbar-nav-sidebar-playlist
Open

fix(player): pass playerBarNavigationAction to sidebar playlist views#439
tsibog wants to merge 3 commits into
sozercan:mainfrom
tsibog:fix/playerbar-nav-sidebar-playlist

Conversation

@tsibog

@tsibog tsibog commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Description

When playing a track from a sidebar playlist (not Liked Music), the artist and album names in the player bar were not clickable.

viewForSidebarPinnedItem created PlaylistDetailView without a playerBarNavigationAction, so it defaulted to .disabled. The PlayerBar inside then saw navigationAction.openArtist == nil, making canOpenCurrentArtist false and rendering the artist name disabled.

Correction from the first revision of this PR: the fix cannot be done with .playerBarMusicNavigation(path:) on the enclosing NavigationStack alone. PlaylistDetailView sets the environment value directly on its own PlayerBar:

PlayerBar()
    .environment(\.playerBarNavigationAction, self.playerBarNavigationAction)

That write is closer to the PlayerBar than the modifier on the stack, so it wins — and since the view was constructed without the argument, it stayed .disabled. The modifier-only version was verified by inspection but never actually worked when built and run.

Liked Music works because it passes the action into the view's initializer (MainWindow.swift:606), not just via the outer modifier. This PR applies that same shape to sidebar playlists.

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)

Related Issues

Fixes #437

Changes Made

  • Add pinnedItemPlayerBarNavigationAction(for:), mirroring likedMusicPlayerBarNavigationAction but keyed on the per-item contentId path.
  • Pass it into PlaylistDetailView and SimplePlaylistDetailView — this is what actually fixes the bug.
  • Pass it to navigationDestinations(client:playerBarNavigationAction:) so the player bar stays clickable after pushing to an artist or album page, matching Liked Music (MainWindow.swift:618-620).
  • Extract pinnedItemNavigationPath(for:) for the path binding that was duplicated inline.

Testing

  • Unit tests pass (swift test --skip KasetUITests) — 2956 tests in 232 suites
  • swiftlint --strict && swiftformat . clean
  • Manual testing performed on a packaged build
  • UI tested on macOS 26+

Verified in a running packaged build: playing a track from a sidebar playlist and clicking the artist name in the player bar now navigates to the artist page, and Liked Music continues to work.

Checklist

  • My code follows the project's style guidelines
  • I have run swiftlint --strict && swiftformat .
  • New and existing unit tests pass locally
  • I have checked for any performance implications
  • My changes generate no new warnings

Additional Notes

While testing this, an unrelated pre-existing bug surfaced: the player bar's album artwork flickers on every view switch. It reproduces in released builds and is not caused by this PR — instrumentation showed the whole PlayerBar is remounted per navigation because each content view constructs its own via .safeAreaInset. Filed separately with the trace data, since the structural fix there would retire this entire class of bug.

tsibog added 2 commits August 13, 2026 14:55
viewForSidebarPinnedItem creates PlaylistDetailView without a
playerBarNavigationAction, defaulting to .disabled. This makes the
artist name and album thumbnail in the player bar non-clickable when
playing from a sidebar playlist. Liked Music already passes one
(likedMusicPlayerBarNavigationAction); apply the same pattern using
the per-item pinnedNavigationPaths binding via .playerBarMusicNavigation.

Fixes sozercan#437
@tsibog

tsibog commented Aug 13, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

PlaylistDetailView/SimplePlaylistDetailView set the environment on their
own PlayerBar, overriding any value set higher up the tree. Passing the
action only via .playerBarMusicNavigation left it at .disabled, so artist
and album names stayed unclickable when playing from a sidebar playlist.

Build the per-item action from pinnedNavigationPaths and pass it into the
detail views and navigationDestinations, matching the Liked Music path.
Extract the duplicated path binding into a helper.
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.

[Bug]: Player bar artist name not clickable when playing from a sidebar playlist

1 participant