dimfeld / svelte-maplibre

Svelte bindings for the MapLibre mapping library
https://svelte-maplibre.vercel.app
MIT License
334 stars 40 forks source link

Test with Svelte 5 #196

Open dimfeld opened 2 months ago

dimfeld commented 2 months ago

This task covers testing that svelte-maplibre works with Svelte 5 as is, and any fixes to be made while keeping the project compatible with Svelte 4.

ivyrze commented 2 months ago

When using the library with Svelte 5 and I'm getting a bunch of new warnings:

[vite-plugin-svelte] node_modules/svelte-maplibre/dist/AttributionControl.svelte:11:18 Properties of objects and arrays are not reactive unless in runes mode. Changes to this property will not cause the reactive statement to update
 9: $:
10:   if ($map && !control) {
11:     control = new maplibregl.AttributionControl({
                                                   ^
12:       compact,
13:       customAttribution
[vite-plugin-svelte] node_modules/svelte-maplibre/dist/FullscreenControl.svelte:16:18 Properties of objects and arrays are not reactive unless in runes mode. Changes to this property will not cause the reactive statement to update
14:       containerEl = container;
15:     }
16:     control = new maplibregl.FullscreenControl({
                                                  ^
17:       container: containerEl
18:     });
[vite-plugin-svelte] node_modules/svelte-maplibre/dist/GeolocateControl.svelte:14:18 Properties of objects and arrays are not reactive unless in runes mode. Changes to this property will not cause the reactive statement to update
12: $:
13:   if ($map && !control) {
14:     control = new maplibregl.GeolocateControl({
                                                 ^
15:       positionOptions,
16:       fitBoundsOptions,

...and so forth for the rest of the controls. Turning on runes mode breaks the build altogether, of course, because the package is still using the Svelte 4 syntax.

benmccann commented 2 hours ago

I've sent a PR to Svelte to remove that warning: https://github.com/sveltejs/svelte/pull/14111

What do you think about upgrading this project to use runes and requiring Svelte 5?

dimfeld commented 2 hours ago

Definitely want to do it at some point. Iā€™m busy with a new startup right now (using svelte 5 šŸ˜) but hope to have some time later this month for that.

On Sat Nov 2, 2024, 05:52 PM GMT, Ben McCann @.***> wrote:

I've sent a PR to Svelte to remove that warning: sveltejs/svelte#14111 https://github.com/sveltejs/svelte/pull/14111 What do you think about upgrading this project to use runes and requiring Svelte 5? ā€” Reply to this email directly, view it on GitHub https://github.com/dimfeld/svelte-maplibre/issues/196#issuecomment-2453061782, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAKOLVWMPULJ5E5SRPDJM4DZ6UGNXAVCNFSM6AAAAABMYQNPJ6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDINJTGA3DCNZYGI. You are receiving this because you authored the thread.Message ID: @.***>