Fix/resolve stale menu and wrong account content after account switch#84
Open
themmm wants to merge 1 commit into
Open
Fix/resolve stale menu and wrong account content after account switch#84themmm wants to merge 1 commit into
themmm wants to merge 1 commit into
Conversation
Three bugs caused menu items and personalized content to not update correctly after switching Deezer accounts (issue philippe44#64): 1. The Flow 'play' URL in handleFeed embedded the userId at menu-build time ('deezer://user/$id/flow.dzr'). On clients that cache the navigation stack (e.g. Squeezeplay firmware), pressing play on Flow after an account switch would still request the old user's flow stream. Fixed by using 'deezer://user.flow' instead, which already handled by getFlow() in ProtocolHandler and resolves against the current player's account at play time. 2. The Flow discovery toggle closure captured $userId from handleFeed's outer scope. After an account switch with a cached menu, toggling the setting would update the old account's preference. Fixed by calling getAPIHandler($client)->userId inside the closure. 3. _userQuery in Custom.pm omitted the userId when auto-computing cache keys (used by _mixes and _smart). Two different accounts requesting the same track mix or smart tracklist would share a single cached result. Fixed by appending $self->userId to the hash input. Callers that supply an explicit _cacheKey (e.g. _home, _pageItems) are not affected. 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.
Disclaimer:
All code-changes have been made with Claude-code.
Changes
Bug 1 — Hardcoded userId in Flow
playURL (Plugin.pm)handleFeedembedded the current userId into a static string at menu-build time for the Flow card's play action. On clients that cache the navigation stack (e.g. Squeezeplay firmware), pressing Play on the Flow card after an account switch would request the old user's radio stream. Fixed by using the dynamicdeezer://user.flowURL instead, which is already used by the inner sub-items and resolves against the current player's account at play time viagetFlow()inProtocolHandler.Bug 2 — Flow toggle closure captured stale userId (Plugin.pm)
The Flow discovery toggle closure captured
$userIdfromhandleFeed's outer scope. After an account switch with a cached menu, toggling the setting updated the old account's preference instead of the new one. Fixed by resolving the current userId dynamically inside the closure viagetAPIHandler($client)->userId.Bug 3 —
_userQueryauto-computed cache key missing userId (Custom.pm)When
_userQueryis called without an explicit_cacheKey(from_mixesand_smart), the cache key was computed from params+content but without the userId. Two different accounts requesting the same track mix or smart tracklist shared a single cached result — the same class of bug fixed in lms-plugin-tidal#81. Fixed by appending the userId to the hash input. Callers that supply an explicit_cacheKey(_home,_pageItems) are not affected.Fixes #64