The page stops recursing when a tap ends long after its answer (#378)

endTap reported the tap before clearing it; report's traceparent starts a
new trace when the last is over a minute old, and newTrace ends the open tap
again, so hiding the page (switching apps on the phone) a minute after using
it recursed until the stack ran out. Timings are never throttled, so nothing
broke the loop. Introduced in #376.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-26 01:47:51 +00:00
parent c4f0a362d8
commit 070b39e840
3 changed files with 13 additions and 2 deletions

View File

@@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
### Fixed
- Switching away from the page a minute after using it no longer stops it with "Maximum call stack size exceeded" (#378).
- Two items from different feeds that share an id, as a blog's RSS and Atom feeds' do, are told apart: in All Subscriptions the second can be opened and marked read, where the first was marked whichever was clicked (#361).

View File

@@ -109,9 +109,12 @@ function spanText(secs: number){
let traceId='', traceAt=0, rootId='', rootAt=0, rootKind='', answeredAt=0;
const hex=(n: number)=>Array.from(crypto.getRandomValues(new Uint8Array(n)),b=>b.toString(16).padStart(2,'0')).join('');
function endTap(){
if(rootKind && answeredAt>rootAt)
report('tap',{trace:traceId,span:rootId,start:rootAt,ms:Math.min(answeredAt-rootAt,60_000),msg:rootKind});
const kind=rootKind;
// Cleared first: report's traceparent can start a new trace, whose newTrace calls endTap again,
// and with the tap still open that recursed until the stack ran out (#378).
rootKind='';
if(kind && answeredAt>rootAt)
report('tap',{trace:traceId,span:rootId,start:rootAt,ms:Math.min(answeredAt-rootAt,60_000),msg:kind});
}
function newTrace(kind: string){
endTap();