profile
viewpoint

Ask questionsslot inside #if inside #each : TypeError cannot read property 'd' of null

REPL link

<script>
  let show = true;
  setTimeout(() => (show = false));
</script>

<div>
  {#each [""] as v (v)}
     {#if show}<slot></slot>{/if}
  {/each}
</div>

Running this causes an error when an update is triggered by the reactive assignment in setTimeout: Chrome: Uncaught (in promise) TypeError: Cannot read property 'd' of null Safari: Unhandled Promise Rejection: TypeError: null is not an object (evaluating 'if_block.d')

If the each block is not keyed (I remove (v)), there's no error.

sveltejs/svelte

Answer questions IOuser

I've had the same errors in keyed each which contain if with svelte:self inside. Maybe, we can just add null-checks to on_outro callbacks?

useful!
source:https://uonfu.com/
Github User Rank List