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

Swapy worked smooth when applied in plain svelte, but is laggy when imported the exact same project in Sveltekit #105

Open
hiprathamesh opened this issue Dec 25, 2024 · 1 comment

Comments

@hiprathamesh
Copy link

swapy-laggy-sveltekit.mp4

The project was imported from plain svelte to Sveltkit after the recent 1.0.0 launch, so it may have something to do with that, although I am not sure. Also, I think I should mention this, when I first implemented Swapy in the plain svelte project, it was a bit laggy at first in that project too, but eventually I don't know how it got fixed.

In the above video it can be clearly seen that in the first dev build, which is in plain svelte, the swapping is very smooth and natural, but when I imported the same project to Sveltekit for better features, the swapping with Swappy is quite laggy

@Ookamini95
Copy link

throwing my 2 cents here even though without the code I'm unable to help further. If you are using dynamic try

this.swapy.onSwapEnd((event) => {
      requestAnimationFrame(() => { // used for swapMode: 'drop', if not used, it will not work after first swap
        this.swapy?.update();
      });
    });

I had similar bugs while implementing for angular, and in my case it was related to how items are tracked

  <!-- track v.item?.index | track v.itemId | track v.slotId | track $index | v  << all these cause various bugs, v is the most stable -->
  @for (v of slottedItems(); track v) {

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