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

[Bug] New onSwapEnd triggers twice #67

Closed
Crinchy opened this issue Sep 23, 2024 · 7 comments
Closed

[Bug] New onSwapEnd triggers twice #67

Crinchy opened this issue Sep 23, 2024 · 7 comments

Comments

@Crinchy
Copy link

Crinchy commented Sep 23, 2024

Hey @TahaSh,

i recognised that the new onSwapEnd event sometimes get triggered twice.

You can simple add a console.log to the event and check your logs while swapping.

I have recorded it:
https://r2.fakecrime.bio/uploads/9d7ab895-ea0a-43e7-93c1-2693a300f87f.mp4

I am using next.js 14 with the app router and heres my useEffect, if it might help to reproduce

useEffect(() => {
  const container = document.querySelector('.container')!;

  const swapy = createSwapy(container, {
    animation: 'dynamic',
    continuousMode: true,
    swapMode: 'drop'
  });

  swapy.onSwapEnd(({ data }) => {
    console.log('test');
  });

  return () => {
    swapy.destroy();
  };
}, []);

I hope you can find the issue and fix it asap 😊
Thanks ❤️

@TahaSh
Copy link
Owner

TahaSh commented Sep 23, 2024

Hey @Crinchy! Are you using v0.3.1? If not, update and try! Thanks!

@Crinchy
Copy link
Author

Crinchy commented Sep 23, 2024

@TahaSh ur a legend, yeah its fixed, havent saw the new version.

@Crinchy Crinchy closed this as completed Sep 23, 2024
@Crinchy
Copy link
Author

Crinchy commented Sep 23, 2024

btw @TahaSh i also saw, that the onSwapEnd event gets triggered if i just click on the button without even moving it, is that already mentioned?

@TahaSh
Copy link
Owner

TahaSh commented Sep 23, 2024

@Crinchy I didn't know about this. Thanks for pointing this out! I'll add it to the list for the next release.

@Crinchy
Copy link
Author

Crinchy commented Sep 23, 2024

@TahaSh should i create a new Issue for this and have you might a eta for when you will get it fixed?

@TahaSh
Copy link
Owner

TahaSh commented Sep 30, 2024

@Crinchy Triggering swapEnd on click without dragging should be fixed now (v0.4.0).

@Crinchy
Copy link
Author

Crinchy commented Sep 30, 2024

Thanks @TahaSh, yeah i can confirm it, its fixed ❤️

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

2 participants