fix: play new particle after playback is ended

This commit is contained in:
talksik
2026-03-19 16:05:02 -07:00
parent 0c19ddcbc7
commit 20fb9a4c6e
@@ -79,6 +79,10 @@ function playbackReducer(
if (action.particleCount === 0) {
return { currentIndex: 0, status: "idle", paused: state.paused };
}
if (state.status === "ended" && state.currentIndex < action.particleCount - 1) {
// New particle appended — resume and advance to it
return { ...state, currentIndex: state.currentIndex + 1, status: "playing", paused: false };
}
if (state.currentIndex >= action.particleCount) {
return { ...state, currentIndex: action.particleCount - 1 };
}