spectacle icon indicating copy to clipboard operation
spectacle copied to clipboard

autoPlayLoop doesn't work

Open zweizwei opened this issue 2 years ago • 1 comments

Prerequisites

  • [x] I have searched the open issues to make sure I'm not opening a duplicate issue
  • [x] I have read through the docs before asking a question
  • [x] I am using the latest version of Spectacle

Describe Your Environment

What version of Spectacle are you using? (can be found by running npm list --depth 0 spectacle) 9.5.1

What version of React are you using? (can be found by running npm list --depth 0 react) [email protected]

What browser are you using? (e.g., Chrome 105.0.5195.102, Safari 16.0) Version 105.0.5195.125 (Official Build) (arm64)

What platform are you on? (e.g., Windows, macOS, iOS, Android) macOS

Describe the Problem

autoPlayLoop doesn't work on my deck

https://codesandbox.io/s/quizzical-fog-uorj8i?file=/src/index.js

Just add autoPlayLoop to Deck (as in documentation) - expected to play slides in loop. Doesn't do so.

Expected behavior: [What you expect to happen]

Just add autoPlayLoop to Deck (as in documentation) - expected to play slides in loop. Doesn't do so.

Actual behavior: [What actually happens]

Just add autoPlayLoop to Deck (as in documentation) - expected to play slides in loop. Doesn't do so.

zweizwei avatar Sep 19 '22 18:09 zweizwei

Thank you for the issue report.

I have confirmed this in some recent work of mine as well. There is a straightforward issue with stale references to a variable (navigation.isFinalSlide in this code) that, if resolved, will fix the main issue.

There is one more issue, however, that I noticed upon investigating: the logic in that hook will loop around to the first slide regardless of any Appear/Stepper-like components existing on the final page, so they will get skipped over without ever being shown. The total number of stepper-things in each slide is stored a little bit deeper in the component hierarchy than the autoPlay logic, so there may be some fairly involved refactoring necessary to get that part working.

fritz-c avatar Sep 19 '22 18:09 fritz-c