Oli8 / spaper

PaperCSS components for Svelte
https://oli8.github.io/spaper/
MIT License
199 stars 9 forks source link

Multiple toast at the same time throws error #75

Open kanimaru opened 11 months ago

kanimaru commented 11 months ago

you can reproduce it directly in the documentation:

https://oli8.github.io/spaper/#/components/Toast

Stacktrace from my project:

Uncaught TypeError: container is null
    removeContainer Toast.svelte:80
    setTimeout handler*removeContainer Toast.svelte:79
    close Toast.svelte:60
    setTimeout handler*instance3/< Toast.svelte:42
    run index.mjs:20
    mount_component index.mjs:2101
    flush index.mjs:1329
    init index.mjs:2197

My guess is that both set a timeout to remove the container for the toast and when one came first the other doesn't find the container anymore. My suggestion hold a variable to the timeout and remove timeout when new toast comes and override the timeout like this.

Oli8 commented 11 months ago

steps to reproduce?

kanimaru commented 11 months ago

Click twice on the toast open button in the example and you will see a error as soon as they dissapeared

Oli8 commented 11 months ago

I do not, browser?

kanimaru commented 11 months ago

Firefox 115.0.1 (64-Bit) Windows Version 10.0.22621 Build 22621