-
-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
readonly(["a", "b", "c"]).includes() tracks dependencies even though array is nonreactive #2493
Comments
You misunderstand what Maybe you are looking for Edit: my analysis here was wrong, see below (#2493 (comment)) |
I'd like to ask why this design is so designed that indexes can't be collected by dependency, but by using lastIndexOf, indexof and includes. Shouldn't readonly behave consistently |
Please be more specific and provide an example. |
setup() { if Shouldn't readonly behave consistently |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Ah, now I get what you mean. I failed at reproducing it properly first with the snippet your provided. Let's look into it, we might have an issue here. |
You may have misunderstood the meaning In the case of readonly(), Why? readonlyState.includes ("a") to collect dependencies, readonlystate [0] will not collect dependencies |
OK, thank you |
So thanks for being adamant here, I was wrong. readonly on a plain value should of course not track. I usually use it on reactive values only and didn't think about it enough. So the problem seems to be here: We should check for |
Thanks for reporting, tracked it down and sent a PR. Apologies for my initial stubborness. |
Thank you for answering my questions |
Version
3.0.2
Reproduction link
https://codesandbox.io/s/vigorous-field-e0xxe?file=/src/App.vue
Steps to reproduce
readonly(["a", "b", "c"]) Collected by dependency
What is expected?
["a", "b", "c"] Should not be collected by dependency
What is actually happening?
["a", "b", "c"] Collected by dependency
The text was updated successfully, but these errors were encountered: