Skip to content

:key shorthand incorrectly compiles to UNKEYED_FRAGMENT #10882

Closed
@NonSpicyBurrito

Description

Vue version

3.4.27

Link to minimal reproduction

https://play.vuejs.org/#eNp9UE1Lw0AQ/SvDXKpQU1BBKKmg0oMeVNSbKxKSSdw22V12NzES8t+d3dDag/S28z5m37wBb4xJupZwianLrTQeHPnWXAslG6OthwEslTBCaXUDM5bOhMq1ch629ONgFeiT949TodLFtIG9PHhqTJ154gkgLWQH3Vmp7Uog+0CqaBcIyzAuWJUuDiw4R+/4m1JWycZpxfmGsEhgrhsja7JPxkuOIXAJkQlcVtf6+yFi3rY03+H5F+Xbf/CN6wMm8NmSI9uRwD3nM1uRn+j16yP1/N6TjS7amtVHyBdyum5Dxkl226qCYx/oYtr72LJU1Ztb956U2x0VggblGPUCufm7I6f/xb1ILqNPqJFb/OzIhp1cIBPJ+RWOv3pFpHc=

Steps to reproduce

In minimal reproduction, see playground compiled JS.

What is expected?

:key should compile to the same output as :key="key".

What is actually happening?

:key compiles to UNKEYED_FRAGMENT, whereas :key="key" compiles to KEYED_FRAGMENT.

System Info

No response

Any additional comments?

Here is a practical example in playground of how this bug can affect behavior by causing stateful tags and components to be rebuilt and thus losing state.

Metadata

Assignees

No one assigned

    Labels

    🔨 p3-minor-bugPriority 3: this fixes a bug, but is an edge case that only affects very specific usage.🐞 bugSomething isn't workingscope: compiler

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions