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!

Related questions

Javascript Interpolation in Styles via CSS Variables? hot 2
Svelte applications fail to load in IE 11. Similar loading issue with the main site svelte.dev hot 1
Uncaught TypeError: y.fragment.l is not a function hot 1
Increase elements when using a combination of await block and transition hot 1
Svelte applications fail to load in IE 11. Similar loading issue with the main site svelte.dev hot 1
Change body class via &lt;svelte:body /&gt; hot 1
Site: Svelte Cookbook/ Examples hot 1
Missing dependencies in svelte/compiler type definitions hot 1
Multiple components in one file - svelte hot 1
onMount Error: Function called outside component initialization hot 1
A way to see if slot prop is present hot 1
unclear / difficult to import uuidv4 hot 1
Use <script type="application/ld+json"> in <svelte:head> hot 1
Error: 'default' is not exported when using babel + moment hot 1
Outros undefined when transitioning to another page hot 1
Github User Rank List