fix(anki): close the timing review modal once main has dropped the review

Main ends a review on its own after the decision watchdog, on overlay
teardown, or when the modal window opened twice, but the renderer only
closed on a successful resolve. Every button then answered 'no longer
active' forever and the overlay stayed interactive over mpv. Stale
results now carry a typed flag and the modal closes on it.
This commit is contained in:
2026-09-03 22:51:22 -07:00
parent 8e47e0d761
commit 144db675e9
5 changed files with 63 additions and 9 deletions
+11 -1
View File
@@ -387,6 +387,10 @@ export function createMediaTimingReviewModal(
) {
return;
}
if (!result.ok && result.stale) {
closeResolvedReview();
return;
}
const path = result.ok ? buildMediaTimingWaveformPath(result.peaks ?? []) : '';
if (!path) {
setWaveformState('unavailable');
@@ -707,11 +711,13 @@ export function createMediaTimingReviewModal(
reviewId: payload.reviewId,
decision,
});
if (!result.ok) {
if (!result.ok && !result.stale) {
setStatus(result.message ?? 'The timing review could not be resolved.', true);
showEditor();
return;
}
// A stale review was already settled by main; keeping the modal up would leave
// controls that can never succeed over a live mpv window.
closeResolvedReview();
} catch (error) {
setStatus(error instanceof Error ? error.message : String(error), true);
@@ -759,6 +765,10 @@ export function createMediaTimingReviewModal(
}
return;
}
if (!result.ok && result.stale) {
closeResolvedReview();
return;
}
if (!result.ok) {
setStatus(result.message ?? 'Audio preview is unavailable.', true);
setPreviewPlaying(false);