When auto-advancing was re-implemented in #361, the app started playing the wrong sound when the section automatically advanced. This was caused by Vue handling the section advance the following way:
The events store receives the TIMER_FINISH event (-> there is a watcher in the web component that plays the next section's sound based on this event)
The schedule store gets the call to advance the current section
The watcher plays the sound of the next section (but by this time, the schedule has already advanced, so it will play the second next section's sound)
This is fixed by wrapping the advance() call in a nextTick, so the correct sound will start playing in the current tick, and only then will the schedule advance.
When auto-advancing was re-implemented in #361, the app started playing the wrong sound when the section automatically advanced. This was caused by Vue handling the section advance the following way:
events
store receives theTIMER_FINISH
event (-> there is a watcher in theweb
component that plays the next section's sound based on this event)schedule
store gets the call to advance the current sectionThis is fixed by wrapping the
advance()
call in anextTick
, so the correct sound will start playing in the current tick, and only then will the schedule advance.