Skip to content

$effects created after the first top-level await never execute #16691

@Ocean-OS

Description

@Ocean-OS

Describe the bug

See #16682 (comment)
The issue here is that regular user effects (ones made specifically with $effect, not $effect.pre or render effects) are deferred until the component is mounted. However, since the code that indicates the component as being mounted, $.pop, runs synchronously (even in async components), the effects are never added to the array of deferred effects for their component (and might(?) be added to the parent component if it exists) if they're created after the first top-level await.

Reproduction

Playground

Logs

System Info

N/A

Severity

annoyance

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions