-
Notifications
You must be signed in to change notification settings - Fork 61
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
Setting $session in Sveltekit breaks the map #58
Comments
Updated svelte and sveltekit and it seems to have resolved the issue. |
Sorry, closed too soon. The error doesn't show up right away. It only happens after a few refreshes/hot-reloads. package.json {
"name": "my-app",
"version": "0.0.1",
"scripts": {
"dev": "svelte-kit dev",
"build": "svelte-kit build",
"preview": "svelte-kit preview"
},
"devDependencies": {
"@sveltejs/kit": "^1.0.0-next.192",
"svelte": "^3.44.0"
},
"type": "module",
"dependencies": {
"@beyonk/svelte-mapbox": "^8.1.4"
}
} index.svelte <script>
import { Map, Marker } from '@beyonk/svelte-mapbox';
import { session } from '$app/stores';
import { browser } from '$app/env';
if (browser) {
// setting $session to anything at all seems to cause the error
$session = 'asdf'
}
let mapComponent;
function onReady() {
mapComponent.flyTo({ center: [-74.0060152, 40.7127281] });
}
</script>
<div>
<h1>Map</h1>
<div class="wrapper">
<Map
accessToken={import.meta.env.VITE_MAPBOX_ACCESS_TOKEN}
bind:this={mapComponent}
on:ready={onReady}
>
<Marker lat="-74.0060152" lng="40.7127281" label="NYC" />
</Map>
</div>
</div>
<style>
.wrapper {
height: 500px;
width: 500px;
border: 1px solid black;
}
</style> |
I've tried to put together a minimal recreation here: https://stackblitz.com/edit/svelte-kit-qdaku8?file=src/routes/index.svelte |
Thanks for the reproduction. I'll have a look and see if I can find out what the issue is as soon as possible. |
If I have a page displaying the map and add the following code it breaks.
The error I get in the console is:
The text was updated successfully, but these errors were encountered: