You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I wanted to use vanilla-calendar-pro for a Sveltekit project but i am running into an issue when trying to destroy an instance. The Sveltekit component looks like this:
<script lang="ts">
// Import Svelte components
import { page } from '$app/state';
import { onDestroy, onMount } from 'svelte';
// Import the Calendar class
// import { Calendar } from 'vanilla-calendar-pro';
let calendar: any = $state();
onMount(async () => {
const { Calendar } = await import('vanilla-calendar-pro');
console.log('onMount', calendar);
// Initialize the calendar
calendar = new Calendar('#calendar', {
disableAllDates: true,
enableDates: ['2025-01-26', '2025-01-27', '2025-01-28', '2025-01-29']
});
calendar.init();
console.log('onMount 2', calendar);
});
onDestroy(() => {
console.log('onDestroy', calendar);
calendar?.destroy();
console.log('onDestroy 2', calendar);
});
</script>
<div class="container">
<div id="calendar"></div>
</div>
When doing a hard refresh on the page the calendar is properly initialized and works like charm, when i navigate away from the page i would expect that the calendar is destroyed but i am seeing this in my console logs:
So it looks like it isn't destroyed... and then i navigate to another page where the calendar component should render a calendar and i see this in the logs:
However the calendar itself isnt rendered and when i inspect the element i see an empty <div id="calendar"></div>. Did i found a bug or am i doing something completely stupid (wouldn't be the first time in my life ;) )
Using "vanilla-calendar-pro": "^3.0.3"
The text was updated successfully, but these errors were encountered:
I wanted to use vanilla-calendar-pro for a Sveltekit project but i am running into an issue when trying to destroy an instance. The Sveltekit component looks like this:
When doing a hard refresh on the page the calendar is properly initialized and works like charm, when i navigate away from the page i would expect that the calendar is destroyed but i am seeing this in my console logs:
So it looks like it isn't destroyed... and then i navigate to another page where the calendar component should render a calendar and i see this in the logs:
However the calendar itself isnt rendered and when i inspect the element i see an empty
<div id="calendar"></div>
. Did i found a bug or am i doing something completely stupid (wouldn't be the first time in my life ;) )Using
"vanilla-calendar-pro": "^3.0.3"
The text was updated successfully, but these errors were encountered: