diff --git a/NucleicRemote/NucleicRemote/Views/SessionDetailView.swift b/NucleicRemote/NucleicRemote/Views/SessionDetailView.swift index 2bbe148..343ca8a 100644 --- a/NucleicRemote/NucleicRemote/Views/SessionDetailView.swift +++ b/NucleicRemote/NucleicRemote/Views/SessionDetailView.swift @@ -538,8 +538,12 @@ struct TranscriptList: View { } prewarmProgress.count = current.count guard !bodies.isEmpty else { return } - prewarmTask?.cancel() - prewarmTask = Task.detached(priority: .utility) { + // Chain batches instead of cancelling the in-flight one: each batch covers *new* rows + // only, so cancelling a predecessor (say, the big open batch, superseded by the first + // streamed row) would permanently drop its coverage. `onDisappear` cancels the head of + // the chain; a predecessor mid-parse just finishes its bounded batch into shared caches. + prewarmTask = Task.detached(priority: .utility) { [previous = prewarmTask] in + await previous?.value for body in bodies { if Task.isCancelled { return } MarkdownText.prewarm(body)