Skip to content

Watch not triggered by changes during rendering #2730

@skirtles-code

Description

@skirtles-code

Version

3.0.4

Reproduction link

Steps to reproduce

I've provided two examples but I believe they're both effectively the same problem. In both cases you just need to click the button and then check the logging.

Notice that the logging from the watch gets behind. The new value isn't logged until the following button click.

The first example uses ref attributes to update a reactive ref. The second example uses an updated hook to achieve a similar effect.

The workaround in both cases is to set flush: 'post'. However, that shouldn't be necessary. Any watchers with flush: 'pre' that are still in the queue at the end of rendering should be processed immediately. I haven't checked the code but it may just be a case of going through another rendering cycle when there are outstanding watchers rather than specifically flushing the pre-watchers.

What is expected?

All remaining watchers should be called by the time the rendering loop completes.

What is actually happening?

The watcher isn't called until the next time rendering is triggered.

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