Skip to content

Toast displays 2 times | SvelteKit #40

@ghost

Description

I'm using SvelteKit and this library to display toast notifications.
Making a project I discovered that calling any notifier function from the onMount of Svelte will duplicate the toast.

unknown

Steps to reproduce bug:

npm create svelte@latest 
my-app
cd my-app
npm install
npm i -D @beyonk/svelte-notifications
npm run dev

Paste the following code in the main +page.svelte:

<script>
    import { NotificationDisplay, notifier } from '@beyonk/svelte-notifications'
    import { onMount } from "svelte"
    let n

    onMount(()=>{
        notifier.success('test1', 7000)
        notifier.success('test2', 7000)
        console.log('test1')
        console.log('test2')
    })
</script>

<NotificationDisplay bind:this={n} />

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions