Code: approve and clearEnrollment in hosted/src/App.tsx; the hashchange handler takeLink in the same file.
Failure path: the user clicks Approve for code A, and approveEnrollment(A) is in flight. A second enrollment link opens in the same tab, and hashchange sets enrolling to code B. A's request resolves, and approve calls clearEnrollment(), which sets enrolling to null and replaces the URL. Code B is gone from memory and from the URL, and the notice reads "Approved A". The user has to open link B again. hosted.md -> "Burrow enrollment" says "A fragment change on /enroll takes the new code without reloading". Here a completion that is already in flight undoes that take.
Suggested fix: in approve, clear only if the enrollment still being shown is the one approved (if (enrollingRef.current?.code === code) clearEnrollment()). Otherwise leave B in place and show the A notice. Add an App test: start an approval, fire a hashchange to a new code, resolve the approval, then assert that the new code is still shown.
Found while trimming #904, which had parked this as a spec "Known gap".
🤖 Generated with Claude Code
Code:
approveandclearEnrollmentinhosted/src/App.tsx; thehashchangehandlertakeLinkin the same file.Failure path: the user clicks Approve for code A, and
approveEnrollment(A)is in flight. A second enrollment link opens in the same tab, andhashchangesetsenrollingto code B. A's request resolves, andapprovecallsclearEnrollment(), which setsenrollingto null and replaces the URL. Code B is gone from memory and from the URL, and the notice reads "Approved A". The user has to open link B again. hosted.md -> "Burrow enrollment" says "A fragment change on/enrolltakes the new code without reloading". Here a completion that is already in flight undoes that take.Suggested fix: in
approve, clear only if the enrollment still being shown is the one approved (if (enrollingRef.current?.code === code) clearEnrollment()). Otherwise leave B in place and show the A notice. Add an App test: start an approval, fire ahashchangeto a new code, resolve the approval, then assert that the new code is still shown.Found while trimming #904, which had parked this as a spec "Known gap".
🤖 Generated with Claude Code