virtua icon indicating copy to clipboard operation
virtua copied to clipboard

Rewrite Svelte adapter with Svelte v5 syntax

Open inokawa opened this issue 1 year ago • 2 comments

Related to #323

Try it after v5 becomes popular enough.

inokawa avatar May 14 '24 12:05 inokawa

What qualifies as enough?

Seems like it's quite close to stable and most people use version 5 for new projects.

And so are we and now looking for a virtual list solution. Would it make sense to just wait some weeks/months for the update or better go figure it out by ourselves?

gyzerok avatar Sep 12 '24 16:09 gyzerok

Svelte 4 syntax seems to work on both 4 and 5, otherwise 5 syntax only works on 5. An OSS should be backward compatible as much as possible so there is no strong reason to migrate for now.

inokawa avatar Sep 13 '24 00:09 inokawa

@inokawa seems like virtua can't be installed for Svelte 5 project due to dependency conflict, because it expects only version 4 in package.json

❯ npm install virtua
npm error code ERESOLVE
npm error ERESOLVE could not resolve
npm error
npm error While resolving: [email protected]
npm error Found: [email protected]
npm error node_modules/svelte
npm error   peer svelte@"^5.0.0-next.1" from @skeletonlabs/[email protected]
npm error   node_modules/@skeletonlabs/floating-ui-svelte
npm error     @skeletonlabs/floating-ui-svelte@"^0.3.1" from the root project
npm error   peer svelte@"^4.0.0 || ^5.0.0-next.0" from @sveltejs/[email protected]
npm error   node_modules/@sveltejs/kit
npm error     peer @sveltejs/kit@"^2.0.0" from @sveltejs/[email protected]
npm error     node_modules/@sveltejs/adapter-auto
npm error       dev @sveltejs/adapter-auto@"^3.2.3" from the root project
npm error     peer @sveltejs/kit@"^2.0.0" from @sveltejs/[email protected]
npm error     node_modules/@sveltejs/adapter-static
npm error       dev @sveltejs/adapter-static@"^3.0.3" from the root project
npm error     1 more (the root project)
npm error   7 more (@sveltejs/vite-plugin-svelte, ...)
npm error
npm error Could not resolve dependency:
npm error peerOptional svelte@">=4.0" from [email protected]
npm error node_modules/virtua
npm error   virtua@"*" from the root project
npm error
npm error Conflicting peer dependency: [email protected]
npm error node_modules/svelte
npm error   peerOptional svelte@">=4.0" from [email protected]
npm error   node_modules/virtua
npm error     virtua@"*" from the root project
npm error
npm error Fix the upstream dependency conflict, or retry
npm error this command with --force or --legacy-peer-deps
npm error to accept an incorrect (and potentially broken) dependency resolution.

gyzerok avatar Oct 10 '24 16:10 gyzerok

Hi @inokawa, I agree with @gyzerok's suggestion.

I believe it is necessary to be compatible. The Svelte 5 API is now stabilizing. The official team also recommends using Svelte 5 directly, and migration tools have been released.

https://svelte-5-preview.vercel.app/docs/old-vs-new https://x.com/dummdidumm_/status/1844750782647685151

heylingyao avatar Oct 14 '24 03:10 heylingyao

The peer dependency issue seems to be not inevitable, because 5.0.0-next.263 doesn't match >=4.0 semver (but 5.0.0 matches it). https://github.com/npm/npm/issues/8854

So after the Svelte 5.0.0 release would be the reasonable timing to release our v5 components. I'll try to migrate virtua after that timing, of course PR welcome.

inokawa avatar Oct 14 '24 04:10 inokawa

I think ^4.0.0 || ^5.0.0 could be used to do this

gyzerok avatar Oct 14 '24 04:10 gyzerok

@inokawa Svelte 5 finally got released now. Eagerly looking forward to be able to use your great virtual list library with it 😃

gyzerok avatar Oct 19 '24 19:10 gyzerok

Released in 0.36.0.

inokawa avatar Oct 27 '24 10:10 inokawa