Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimization of computed value is not working any more #11228

Closed
alexzhang1030 opened this issue Jun 26, 2024 · 1 comment
Closed

Optimization of computed value is not working any more #11228

alexzhang1030 opened this issue Jun 26, 2024 · 1 comment

Comments

@alexzhang1030
Copy link
Member

alexzhang1030 commented Jun 26, 2024

Vue version

>=3.4.15, 3.4.13

Link to minimal reproduction

https://play.vuejs.org/#eNp9kk1PwzAMhv9KlAudKN0m4DK2STDtMA6AAHGKhKrO3TratEqcbVLV/46T7KNFaKc29uvHr53U/LGqoq0BPuJjnaisQqYBTTUVMiuqUiGrmYI0ZElZVAZhGbJdjMn68JmnKSTIGpaqsmBXBLoSUsiklBqpxEhkE1sfDHs2TuiFRFDbOA+CHptMWS0k88KIggbY9YQNhWxCNhwMBq7Iw1JJpCCKolittCsl2bmTN/flEJPT+dAklUGrRa9FVaBALkHNWlZ919Z4XautTp73YOMdUHcUwo37fre0VTogFFUeI9DpDByxuv4zR9N48o1H+zU5Xde21Y37LSoPOWoaMM1W0UaXki7XmRfcNshyUK8VZrQAwQlnMzYX53m5e3YxVAbCYzxZQ/LzT3yj9zYm+JsCTXcKgp9ySLcE6NPzjxfY0/8pWZRLk5P6QvIddJkb69HLnoxcku2WzrlduCeaydWnnu8RpD4OZY1aZeP0gtPDnF0Y/Wz3NrpzdXRvtMXvLSjLpAVSIhre8+YXrugTTQ==

Steps to reproduce

See re-render count

What is expected?

re-render count should always be 1, you can choose [email protected] and see.

What is actually happening?

If vue@^3.4.15, the re-render count always increases even if the computed value is unchanged.

System Info

No response

Any additional comments?

@johnsoncodehk implemented this feature in PR #5912

@Doctor-wu
Copy link
Member

In your case, you access rerenderCount and mutate it immediately, this makes the effect always dirty, and then once you mutate the dependencies chain, this effect will always re-calc which is expected.

@github-actions github-actions bot locked and limited conversation to collaborators Jul 13, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants