Skip to content

state_unsafe_mutation when updating state inside outrostart event #14124

@mattjennings

Description

@mattjennings

Describe the bug

When updating state inside of an event handler for the outrostart event on a node, the following error occurs:

Uncaught Svelte error: state_unsafe_mutation
Updating state inside a derived or a template expression is forbidden. If the value should not be reactive, declare it without `$state`

This does not happen if using the onoutrostart callback prop, or other transition events/props

Reproduction

https://svelte.dev/playground/81e7a862e846456d9254886c17d18fbb?version=5.1.9

You'll see the error when toggling out

Logs

No response

System Info

System:
    OS: macOS 15.0.1
    CPU: (10) arm64 Apple M1 Max
    Memory: 157.22 MB / 32.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.15.0 - ~/.nvm/versions/node/v20.15.0/bin/node
    npm: 10.9.0 - ~/.nvm/versions/node/v20.15.0/bin/npm
    pnpm: 8.12.0 - /opt/homebrew/bin/pnpm
    bun: 1.0.0 - ~/.bun/bin/bun
  Browsers:
    Chrome: 130.0.6723.92
    Safari: 18.0.1
  npmPackages:
    svelte: ^5.1.2 => 5.1.2

Severity

annoyance

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