Skip to content

Commit 7d89998

Browse files
committed
Deduplicate reduced ink completion
1 parent 7256eb1 commit 7d89998

1 file changed

Lines changed: 13 additions & 2 deletions

File tree

frontend/taskdeck-web/src/components/paper/InkBleed.vue

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ const isReducedMotion = ref(false)
7777
// Initial render: dried+stamped frame so SSR / no-JS shows the final state.
7878
// onMounted will rewind to 'drop' for animated users (when phase === 'auto').
7979
const currentPhase = ref<InkBleedRuntimePhase>('dried')
80+
const doneEmitted = ref(false)
8081
8182
const timers: ReturnType<typeof setTimeout>[] = []
8283
@@ -90,7 +91,17 @@ function setPhase(next: InkBleedRuntimePhase): void {
9091
if (currentPhase.value === next) return
9192
currentPhase.value = next
9293
emit('phasechange', next)
93-
if (next === 'dried') emit('done')
94+
if (next === 'dried') {
95+
emitDoneOnce()
96+
} else {
97+
doneEmitted.value = false
98+
}
99+
}
100+
101+
function emitDoneOnce(): void {
102+
if (doneEmitted.value) return
103+
doneEmitted.value = true
104+
emit('done')
94105
}
95106
96107
function scheduleSequence(): void {
@@ -109,7 +120,7 @@ function applyReducedPhase(next: InkBleedPhase): void {
109120
clearTimers()
110121
if (next === 'auto') {
111122
setPhase('dried')
112-
if (currentPhase.value === 'dried') emit('done')
123+
if (currentPhase.value === 'dried') emitDoneOnce()
113124
return
114125
}
115126
if (next === 'dried') {

0 commit comments

Comments
 (0)