Skip to content

State change within reactive handler requires wrapping in tick() #5848

Closed
@arackaf

Description

@arackaf

Is this about svelte@next? This project is currently in a pre-release stage and breaking changes may occur at any time. Please do not post any kind of bug reports or questions on GitHub about it.

No

Describe the bug
A clear and concise description of what the bug is.

A state change that's inside of a reactive handler requires wrapping in tick() for the state change to register. REPL below.

Logs
Please include browser console and server logs around the time this bug occurred.

N/A

To Reproduce
To help us help you, if you've found a bug please consider the following:

https://svelte.dev/repl/b4ec7663c4d44085a754160863cb611c?version=3.31.1

Basically, toggle disabled on, then off. You should see an activated message, but won't. To fix, go to the Thing component, and comment out line 31, and uncomment 34 (which has the call to tick())

Occasionally, this won't be possible, and that's fine – we still appreciate you raising the issue. But please understand that Svelte is run by unpaid volunteers in their free time, and issues that follow these instructions will get fixed faster.

Expected behavior
A clear and concise description of what you expected to happen.

Should work

Stacktraces
If you have a stack trace to include, we recommend putting inside a <details> block for the sake of the thread's readability:

N/A

Stack trace

Stack trace goes here...

Information about your Svelte project:
To make your life easier, just run npx envinfo --system --npmPackages svelte,rollup,webpack --binaries --browsers and paste the output here.

  • Your browser and the version: (e.x. Chrome 52.1, Firefox 48.0, IE 10)
    Chrome 87

  • Your operating system: (e.x. OS X 10, Ubuntu Linux 19.10, Windows XP, etc)

Mac OS

  • Svelte version (Please check you can reproduce the issue with the latest release!)

Latest in REPL

  • Whether your project uses Webpack or Rollup

REPL

Severity
How severe an issue is this bug to you? Is this annoying, blocking some users, blocking an upgrade or blocking your usage of Svelte entirely?

Blocking to anyone who wouldn't think to use tick()

Note: the more honest and specific you are here the more we will take you seriously.

Additional context
Add any other context about the problem here.

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