Build a review journey for reviewer 29: filter the queue to Pending, move to page two, open case 47 from row 31, then return with Back. A direct link and a reload must reproduce the filter and case state. A meaningful selection adds one history entry; typing into an uncommitted search does not add twenty entries. The case route places keyboard focus on its heading. Returning to the queue restores a stable row anchor after data and fonts are ready, unless the user has already scrolled. The browser may restore an entire suspended page, so sign-out in a second tab or a changed case version must trigger a fresh authority check before the old action controls are treated as current. A likely future route may be warmed, but private case HTML must not be fetched for every visible link.
Project: history-safe review journey
Build contract
- Define canonical URL parsing for filter, cursor, and case ID; test direct entry, reload, Back, and Forward under one route model.
- Record one stable row anchor and move focus on new navigation; cancel delayed scroll restoration after manual user input.
- Handle pageshow restoration and recheck session plus case version before enabling volatile actions.
- Limit speculative loading to safe public route assets, with a byte budget and a normal-navigation fallback.
Implementation checkpoint
function mayRestoreQueue(anchor, currentFilter, userMoved) {
return Boolean(anchor) && anchor.filter === currentFilter && !userMoved;
}
console.log(mayRestoreQueue({ filter: "Pending", caseId: 47 }, "Pending", false));
// Output: trueCost and boundaries
Parsing q URL fields is O(q), and locating a prior row among n rendered rows is O(n) unless an existing row index is available. A stable anchor takes little storage but may require waiting for a delayed queue response; a pixel coordinate is faster to apply and easier to get wrong. Speculating p route resources of average b bytes can spend O(p × b) transfer before any click. Measure first-route timing, back-navigation latency, focus correctness, unused prefetched bytes, and permission-recheck timing together. A fast restored page that advertises an unavailable action fails the project.
Failure drill
Push every search keystroke into history and count how many Back presses are needed to leave the queue. Change the account in another tab, return with Back, and verify the restored page does not keep its private action enabled. Delay the queue response until after the user manually scrolls; the old restoration task must not jump the page later. Change row heights with longer translated titles and remove the original anchor row, then inspect the fallback. Hover case 47 without opening it and confirm no private detail request or analytics visit occurs.
Acceptance checks
- Direct links, reload, Back, and Forward reproduce route state without a long typing history.
- Focus enters new content and Back returns near the prior queue row after slow loading.
- A restored page rechecks session and volatile case data before allowing action.
- Speculative work stays within its budget and never fetches every private case.
Common Mistakes
- Changing history without updating content.
- Resetting scroll on Back or restoring it after a new manual scroll.
- Treating a suspended page as freshly authorized.
- Prefetching all private case links as a performance shortcut.
Related lessons
URL State and History Entry Contracts; Back-Forward Cache and Restored State; Route Scroll and Focus Restoration; Navigation Prefetch and Private Data Budget; Browser Routing and History State.
