Skip to content

@const clashes with animate #7124

Closed
Closed
@janosh

Description

@janosh

Describe the bug

Very cool that {@const} is out now! Thanks again to @tanhauhau in #6413! 👍

There's a problem using it together with animate. The following snippet raises

An element that uses the animate directive must be the sole child of a keyed each block
<script>
  import { flip } from 'svelte/animate'
  const indices = [...Array(10).keys()]
</script>

  {#each indices as idx (idx)}
    {@const idxp1 = idx + 1}
    <li animate:flip>
      {idxp1}
    </li>
  {/each}

Reproduction

REPL

Logs

No response

System Info

Irrelevant

Severity

blocking an upgrade

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugcompilerChanges relating to the compiler

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions