FormidableLabs / spectacle

A React-based library for creating sleek presentations using JSX syntax that gives you the ability to live demo your code.
https://commerce.nearform.com/open-source/spectacle/
MIT License
9.71k stars 690 forks source link

Fix autoPlayLoop #1239

Closed fritz-c closed 1 year ago

fritz-c commented 1 year ago

Description

The autoPlayLoop prop did not actually make the slideshow loop when autoplaying.

The fix for that was fairly straightforward, but uncovered another bug - any Appear or Stepper components on the final slide would get skipped over when jumping from the final slide to the start. That required reworking the slide logic to wrap around to the start when the final step of the final slide was exceeded.

That again, was relatively straightforward, but uncovered another bug - animations occurring when wrapping from the end to the start of the slideshow were fairly rough, with slides coming and going seemingly randomly. A little work on existing internal logic fixed it for most cases, but due to the nature of the existing animation logic, I was unable to find a simple solution to the rough animations occurring when wrapping around with a two-slide presentation. It certainly is possible to rework the animations such that we don't need to make any compromises, but the scale of such a project went way beyond what I was prepared to do for this bugfix.

Fixes #1224

Type of Change

How Has This Been Tested?

I updated the existing useAutoPlay tests to account for the newer, simpler behavior of the hook, and added a new unit test to test autoPlay+autoPlayLoop behavior from the user's perspective.