fix(qt): take the view to the session you just opened, every time

Reported: opening a folder left the view on whatever tab was already showing.

The handler watched `ephemeralActive`, and that flag is ALREADY true when you
open a second folder over a first — or when the boot restore opened one before
you ever touched the view. So it fired exactly once in the life of the app and
then never again, which is precisely the symptom.

It now watches an open SEQUENCE that changes on every open. The discriminator
was already in the code and did not need inventing: `open()` and `open_path()`
pass a runtime to `scan`, `rehydrate()` passes None. Bumping only for the
former is what keeps a remembered folder from stealing the tab you actually
navigated to at startup.

Also restores `onEphemeralActiveChanged`, which I deleted by accident in the
label commit: a range replacement swallowed the handler sitting between the
two edits. It is the fallback that sends you to Albums when the session closes
under you, and without it closing a session left `activeTab` pointing at a tab
that no longer exists — a blank content area. It had been smoke-tested BEFORE
that edit, so the test was valid when it ran and stale by the time it landed.

Verified in the reported scenario: standing on Albums with one session open,
opening a different folder switches to the tab, the label changes and the
count follows.

cc
This commit is contained in:
vicrodh committed 2026-08-20 22:23:34 -06:00
1 parent ffc2d7d664
commit 45c686fab0
3 files changed
+157 -6

No files matched your search

@@ -201,6 +201,33 @@ Rectangle {
/// contradict the now-playing bar on the same screen.
readonly property string ephemeralLabel: QbzLocal.localEphemeralLabel
/// The ephemeral tab is the only one that can VANISH while the user stands
/// on it (the folder is closed, the disc is ejected). Without this the view
/// keeps `activeTab === "ephemeral"` with no tab in the bar and no Loader
/// active: a blank content area and no way back except another tab. Albums
/// is the fallback because it is this view's own default (:63).
onEphemeralActiveChanged: {
if (!ephemeralActive && activeTab === "ephemeral") activeTab = "albums"
}
/// Opening something must LAND you on it. While the pane was an arm of the
/// Folders tab this was implicit — the arm simply took the tab over.
///
/// This watches the open SEQUENCE, not `ephemeralActive`. The flag is
/// already `true` when you open a SECOND folder over a first, so a handler
/// on the flag fires exactly once in the life of the app and then never
/// again — which is precisely the reported symptom: the view stayed on
/// whatever tab you were reading. A sequence changes on every open.
///
/// It also excludes the boot restore by construction:
/// `local_ephemeral::scan` bumps it only when a runtime is passed, and only
/// `open`/`open_path` pass one. A remembered folder therefore never steals
/// the tab you actually navigated to.
Connections {
target: QbzLocal
function onLocalEphemeralOpenSeqChanged() { root.activeTab = "ephemeral" }
}
// ---------------------------- documents ------------------------------
function parseDoc(json, fallback) {
if (json === "") return fallback