I am new to Svelte and want to do something like this in my +page.js:
export async function load() { let prom = new Promise((res) => { setTimeout(() => res('myData'), 10000) }) let value = await prom return { value }}
And the following is my +page.svelte:
<script> export let data</script>{#await data.value}<pre>data is Loading...</pre>{:then value}<pre>data is {'value'}</pre>{:catch error}<p>error loading comments: {error.message}</p>{/await}data is Loading...</pre>{/if}
But, I am not getting the :else
part on my page at all. Instead, the entire page keeps loading for a whole 10sec and then flashes the data value directly. How can I achieve the expected?