Skip to content

Can't Set Reactive Property Asynchronously #487

@bendytree

Description

@bendytree

Apologies if I'm totally missing something here but can't get reactivity to work. For example:

<div>{{ count }}</div>
setup() {
    const state = reactive({ count: 1 });
    setTimeout(() => { state.count = 2; }, 1);
    return state;
}

In Vue 3 this works. Count is updated to 2:
https://jsfiddle.net/8ogjahcb/

In composition-api (v1.0.0-beta.10) count never gets updated. It stays at 1.
https://jsfiddle.net/msrz7w4e/

This example was inspired by the Vue 3 docs.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions