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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

changeComplete is not called when a big lag happens at the very start #863

Open
signorpipo opened this issue Aug 3, 2023 · 0 comments
Open

Comments

@signorpipo
Copy link

The issue is in this piece of code:

if (insTime > insDelay && insTime < insEndDelay) {
      if (!instance.changeBegan) {
        instance.changeBegan = true;
        instance.changeCompleted = false;
        setCallback('changeBegin');
      }
      setCallback('change');
      setAnimationsProgress(insTime);
    } else {
      if (instance.changeBegan) {
        instance.changeCompleted = true;
        instance.changeBegan = false;
        setCallback('changeComplete');
      }
    }

If u have a very big lag, insTime can be more than insDelay and also more than insEndDelay before ever going into the first if, which means changeBegan will never become true, and therefore, changeComplete will never be called

You can easily repro this by putting a break point on the first if check, and after a few seconds (more than the insEndDelay) break again
U will see that insTime will be outside of the first if, but changeBegan is still false

A possible solution would be to change the first if to:

if (insTime > insDelay && (!instance.changeBegan || insTime < insEndDelay) {

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

No branches or pull requests

1 participant