Skip to content

Hooks not re-added after v-if optimization in options API #12020

@solesonicsteph

Description

@solesonicsteph

Vue version

3.5.7

Link to minimal reproduction

https://play.vuejs.org/#eNp9VE1v2zAM/SuELmmBJim2njInwzZ0QHbYhq23aQfVphO1smRIdJog8H8f5a84Qdf4EOmR1Hv8kI7iU1nOdhWKhUhC6nVJK2n5I9yXzhNkmKvKEBwjJsmqAhcgxQMGkuKmBVNXlM6ipbCAY92BmSJ1dd3HSfJIlbenfQyzmSbtrDLrrwvIlQnYBccv12iyyDXwSKo/tKueBAsdSf/8HSmpCDls4DFoN7Rdh9uxmEEObXWYNUyz1hGWyyXcdjQnov4/9aj4/NNZvUGFg02hcJU9M0tqGM5ShSWQr3DgaDw2SF9YvLKHtc3d1fVFogXS1mWxvn3UZUC0QPcLSA+6QFfRFRuWq3HiHV+TMyuRQkFsKlj3wqW+dLsU3jSJtfVM9Q28u369WLFXyXw0Uwm3qzRcvrijJNM7SI0KYSlFMb2TooE7w26qc8bP6Nkj1z4QPBqXPsOL5m5ZBx5z9GhTBHLQDwCU3pXJnI86PxVZfocwpi07M1q4DA3TNUWRAuaDy/EIwwBBXQ+RY/GPFZGzHLbokVPIR5hkOqhHw5LSygfnp9bRVBnjXjCbwAImE85LMbhFH8fRbs5kD+t+lczHZbRJoINBCKkrMVtxveN2JW4EMWRzvZk9BWf5djfjEStalNqg/1HGsgYpmpGKreRJiKq+NVgcUO5ii6dbTJ9fwZ/CPmJS/PQY0O+wuamtjZTnCW3N97+/4759Lloj17sy7P2G8RcGZ6qosXX7XNmMZY/8GrVrfnk8cdEewv2e0IY+qSg0esZZjN78xMXr8r/UT3Lfz+6aOGlrUf8D14/M9Q==

Steps to reproduce

Open the link, look at the output. lengthIs0 is showing true

What is expected?

lengthIs0 should have been recomputed after the setTimeout - however, it appears after initial optimization related to the v-if statement, the hook is not being added back on conditional change.

This worked in 3.4 - and works in composition api, however, is not working for options in 3.5.7 (or 8)

What is actually happening?

Computed, is not, in fact, computed.

System Info

No response

Any additional comments?

I upgraded from 3.4 ==> 3.5.7 and a unit test broke, upon investigation, this is where I landed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    ❗ p4-importantPriority 4: this fixes bugs that violate documented behavior, or significantly improves perf.regressionscope: reactivity

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions