From 1575ba4684570ec2ddf88e856abe79d7949d8780 Mon Sep 17 00:00:00 2001 From: Broque Thomas <26755000+Nezreka@users.noreply.github.com> Date: Tue, 19 May 2026 12:55:38 -0700 Subject: [PATCH] Fix stale _artistDetailGoingBack flag when back lands on non-artist page If history.back() navigated away from artist-detail entirely (e.g. to library), _artistDetailGoingBack stayed true. The next forward artist navigation would then pop the label stack instead of pushing, causing the back-button label to show plain Back instead of the correct page. Guard the pop with currentPage === artist-detail; clear the flag unconditionally in the else branch. --- webui/static/library.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/webui/static/library.js b/webui/static/library.js index bce5bfbf..f8ed0960 100644 --- a/webui/static/library.js +++ b/webui/static/library.js @@ -818,10 +818,13 @@ function navigateToArtistDetail(artistId, artistName, sourceOverride = null, opt console.log(`🎵 Navigating to artist detail: ${artistName} (ID: ${artistId}${sourceOverride ? `, source: ${sourceOverride}` : ''})`); // Maintain the label stack. Back navigations pop; forward navigations push. - if (_artistDetailGoingBack) { + // Only treat the flag as a back-nav signal when we're still on artist-detail — + // if history.back() landed on a non-artist page first, the flag is stale. + if (_artistDetailGoingBack && currentPage === 'artist-detail') { _artistDetailLabelStack.pop(); _artistDetailGoingBack = false; } else { + _artistDetailGoingBack = false; // clear any stale flag if (currentPage !== 'artist-detail') { _artistDetailLabelStack = []; // fresh chain from a non-artist page }