The issue involves async behavior and initialization order, which requires understanding Svelte's internals.
The issue involves accessing an async derived value before it is initialized, leading to an undescriptive error. The problem requires understanding Svelte's rendering order and async behavior. The scope is somewhat clear, but the solution might involve deeper changes to how derived values are handled.
This code
<script>
function get(){
return b;
}
const a = $derived(get());
const b = $derived(await 42);
</script>
{a}
throws a Cannot read properties of undefined (reading 'f') in <unknown> in __wrapper.svelte
because when it tries to get b since b it's an async derived it's not initialized yet by the time the function for a executes. We should at least throw a more descriptive error (or possibly fix this).
repl
annoyance
Claim this issue to let others know you're working on it. You'll earn 10 points when you complete it!