onMount too late for initialization


I noticed, that onMount with svelte is called after the Dom is rendered.
This produces errors on my page, since there are parts in the template which depend on variables and when they are undefined an error is thrown for accessing undefined properties.

I am fairly new to framework7 and svelte, how can I make sure, that certain variables exist before rendering the Dom?

Thanks and kind regards

Try to add delay in onMount,

setTimeout(() => {
}, 500)