Repository navigation
fix(router): abort a joined preload when the router stops - #45
Conversation
Navigating onto an in-flight preload replaced its AbortController, so stop left the loader signal orphaned. Signed-off-by: Sebastien Tardif <sebtardif@ncf.ca>
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed September 30, 2026, 9:53 PM ET / October 1, 2026, 01:53 UTC. ClawSweeper reviewWhat this changesThe PR makes navigation retain a joined preload’s abort controller, adds a stop-and-restart regression test, and records the fix in the changelog. Regression provenancePossible regression — suspected (reviewed change). No predecessor PR is attributed. Merge readiness✅ Ready for maintainer review Current main still replaces the controller when navigation joins an in-flight preload. This PR addresses that cancellation gap, and its targeted regression test and built-package terminal trace support keeping it open for normal merge review. Priority: P2 Review scores
Verification
How this fits togetherThe router receives route catalogs, load contexts, and navigation or preload requests. It manages route matches and loader results, then exposes state for the application to display. flowchart LR
A[Preload request] --> B[In-flight route match]
C[Navigation] --> D[Join existing load]
B --> D
D --> E[Shared abort signal]
F[Router stop] --> E
E --> G[Loader result handling]
G --> H[Route state]
Before mergeNone. Agent review detailsSecurityNone. Review metrics
Technical reviewBest possible solution: Keep one live abort signal across preload adoption and navigation, with stale-result suppression verified across stop and restart. Do we have a high-confidence way to reproduce the issue? Yes. Current-main source shows the controller replacement, and the new focused test exercises preload adoption followed by stop and restart; this read-only review did not execute it. Is this the best way to solve the issue? Yes. Retaining the live preload controller at adoption directly repairs the ownership gap while preserving the existing stale-result guards. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 82b66b32de46. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
What Problem This Solves
Starting a navigation onto a preload that was still loading replaced the abort controller stored on that match. Stopping the router aborted the replacement. The loader kept the original signal. After the router started again, that late result could overwrite the new active match.
Why This Change Was Made
When navigation adopts a match that is still fetching, it keeps that match's abort controller. Stopping the router aborts the same signal the loader already holds. A preload that was not joined still stops the way it did before.
User Impact
Leaving a page while its preload is being adopted no longer lets the old loader replace the data for the next visit.
Evidence
Terminal output from the built router at
/tmp/oc-pr-uirouter-f004, commit8b4ec5b31ca262905f4d86a6b7edfd9a1c20eb4b:Command:
node /tmp/oc-pr-uirouter-f004-proof.mjsReal behavior proof
@openclaw/uirouterat commit8b4ec5b31ca262905f4d86a6b7edfd9a1c20eb4bin/tmp/oc-pr-uirouter-f004.node /tmp/oc-pr-uirouter-f004-proof.mjsbob, and resolving the oldaliceloader left the active data asbob.Validation
pnpm run checkpassed in/tmp/oc-pr-uirouter-f004before the commit (format, typecheck, lint, 53 router checks, and pack).