Skip to content

[Bug] New onSwapEnd triggers twice #67

@Crinchy

Description

@Crinchy

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 ❤️

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions