Skip to content

ues ref on dom element will not trigger watch or watchEffect #2456

Closed
@Jokcy

Description

@Jokcy

Version

3.0.2

Reproduction link

https://jsfiddle.net/h8k7rp45/1/

Steps to reproduce

just click the text Hello Vuejs, then look at the console, it will output undefined once, then after 1 second, output hehe0. If I remove the setTimeout, the hehe0 will never output

What is expected?

output hehe0 when CompA mounted

What is actually happening?

not output hehe0 when CompA mounted


it mainly because watch & watchEffect push preJobs, and ref.value = element worked at queue jobs (the middle), when push preJobs, it's still flushing, so it will not flush again. And after postEffects, no queue jobs and postEffects add, it won't run preJobs again.

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