fix(nav): a linked player, file and search survive what the app does by itself (review round 2)
- Playlists: a link over a playlist the account does not hold plays alone; the rail's own fallback no longer counts as a pick that gives the player up. - The linked opener opens or clears nothing once the address names another player, and stops looking (and fetching its row) once it settled. - Files: a list the server's cap cut — the sorted or searched one too — keeps the link, with a notice of its own (EN/HU). - History: an in-place view rewrite (search refine, count, channel to channel, sub-view) drops a reloaded entry's overlay marks (replaceView); a landing on a channel opened from a search keeps the search; the Feed press on a search opens the plain feed. - Files/Playlists: an emptied search is written at once. - Client log: plf/cf (column text filters) are typed keys; the shell has none of its own. - Contract: writers outside lib/ take a literal or a lib/ function's result; every URL key is sorted typed or not; the writer regexes are held by a fixture; sub-views named; the bookmark net reads page tags. - Feed defaults in one constant; one live-search queue helper; Scheduler writes through the Activity codec; notRun copy (EN/HU) names Forward and a plain "Search YouTube" button.
This commit is contained in:
@@ -253,7 +253,7 @@ export function useHistorySubview<T>(
|
||||
function writeSubEntry<T>(next: T, url: SubviewUrl<T> | undefined): void {
|
||||
const kept = url?.entry ? url.entry(next) : next;
|
||||
const href = url ? urlWithParams({ [url.key]: url.encode(next) }) : "";
|
||||
window.history.replaceState({ ...window.history.state, _sub: kept }, "", href);
|
||||
replaceView({ ...window.history.state, _sub: kept }, href);
|
||||
}
|
||||
|
||||
// --- Overlays / modals (one history entry each, nesting-safe) -------------------------------
|
||||
@@ -304,6 +304,21 @@ let historyDepth = 0;
|
||||
let reloadedOverlayEntry: unknown = window.history.state?._ov ?? null;
|
||||
const reloadedDepth: unknown = window.history.state?._ovd;
|
||||
let deadBelow = 0;
|
||||
|
||||
/** Rewrite the current entry in place for another view (a refined search, another channel, a
|
||||
* sub-view followed): `state` and `href` as replaceState takes them. With no overlay open, the
|
||||
* entry's overlay marks go — the ones a reload under an overlay left. They named the view it was
|
||||
* left from, and the first overlay over the new one would take this entry over: closed, it stepped
|
||||
* back onto the entry below and the screen went back to the view before the rewrite. */
|
||||
export function replaceView(state: Record<string, unknown>, href?: string): void {
|
||||
if (historyDepth > 0) {
|
||||
window.history.replaceState(state, "", href);
|
||||
return;
|
||||
}
|
||||
reloadedOverlayEntry = null;
|
||||
const { _ov: _overlay, _ovd: _depth, ...view } = state;
|
||||
window.history.replaceState(view, "", href);
|
||||
}
|
||||
// Programmatic history steps back still awaiting their popstate — each must be ignored — and how
|
||||
// many entries they step over in all (a step over dead entries is one traversal of several).
|
||||
let pendingProgrammatic = 0;
|
||||
|
||||
Reference in New Issue
Block a user