mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-08-04 19:21:33 -07:00
fix(subtitles): re-annotate invalidated text during autoplay priming
Autoplay priming called onSubtitleChange after a cache miss, which only asks whether the text is new. When the miss came from an invalidation (mining a card while the line is on screen) the text was unchanged, so nothing was scheduled and the line stayed unannotated for as long as it was displayed. refreshCurrentSubtitle checks the cache generation as well, so it re-tokenizes for the new generation; the resume fallback is kept for the case where it genuinely has nothing to do. refreshCurrentSubtitle also returned false for empty text while a run was in flight, even though that run goes on to emit the empty subtitle. It now reports the pending emit so callers do not release the prefetch pause early. The priming tests now drive the real subtitle processing controller instead of a stub. The previous stub encoded the wrong assumption about unchanged text and so could not catch either bug.
This commit is contained in:
@@ -197,7 +197,9 @@ export function createSubtitleProcessingController(
|
||||
latestText = textOverride;
|
||||
}
|
||||
if (!latestText.trim()) {
|
||||
return false;
|
||||
// A run in flight will pick this up and emit the empty subtitle, so
|
||||
// the caller is still waiting on an emit.
|
||||
return processing;
|
||||
}
|
||||
if (processing) {
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user