Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix infinite looping bug #469

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jeff-wolff
Copy link

@jeff-wolff jeff-wolff commented Oct 14, 2022

Hello 馃憢
timeSinceStart incorrectly calculated in the script as this.startScrollTs is undefined.
preventing checkScroll() from initiating stopScrolling()

Steps to reproduce the behavior:

  1. Scroll away and press "Home" on your keyboard
  2. Observe the loop not stopping the transform function

Fixed by changing this line:
timeSinceStart = Date.now() - this.startScrollTs;

to

timeSinceStart = Date.now() - this.startScrollTs ? this.startScrollTs : Date.now();

There might be a better way to initialize this.startScrollTs?

@jeff-wolff jeff-wolff mentioned this pull request Oct 14, 2022
@Dushyant1295
Copy link

@devenini @Jerek0

@RafaelKr
Copy link

Wouldn't it be better to write this?
const timeSinceStart = this.startScrollTs ? Date.now() - this.startScrollTs : 0;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants