Skip to content

actions and attachments don't work in async components #16651

@ottomated

Description

@ottomated

Describe the bug

All attachments and actions are broken in any component with an await in its script block. They don't get called immediately and I'm unable to reproduce when they eventually do get called.

This reproduces it, and commenting out the promise works.

<script>
  await Promise.resolve()
</script>

<div {@attach () => { console.log('never runs') }}></div>

Reproduction

REPL

Severity

blocking all usage of svelte

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions