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

fix(runtime-core): eager property access cache issue (fix #1016) #1029

Closed
wants to merge 2 commits into from

Conversation

aztalbot
Copy link
Contributor

@aztalbot aztalbot commented Apr 22, 2020

Certain options like data, watch, and provide, run synchronously when applying options and may attempt to access fields that don't exist yet. Since the public instance proxy handler attempts to cache these accesses, the field may end up with the wrong code (data vs. setup, etc), and appear as if it does not exist to options that get applied later (we see this primarily with mixins, as in #1016).

This PR fixes that issue by replacing the instance.accessCache object after applying mixins. It is possible to instead add keys to the cache as they are applied, but that would involve more code and could unnecessarily cache fields not needed during render. Adding additional logic in the proxy handler itself didn't seem wise, since it is a "hotspot."

I found another issue where a computed on a mixin that depends on data from a later mixin does not update after that data is added. To fix this, if the computed value is undefined, the computed is recreated.

I also noticed that inject was not available to the data option as it was in Vue 2, so I moved application of inject options up before data, but kept the dupe check after the other options.

@yyx990803 yyx990803 closed this in ff4d1fc Apr 22, 2020
@yyx990803
Copy link
Member

Thanks a lot for the PR, however, it did not address the root cause of the issue (in your branch the watcher doesn't register the correct values).

We can still use some of the tests to ensure behavior correctness - which can be made into a separate PR.

pikax pushed a commit to pikax/vue-next that referenced this pull request Apr 29, 2020
…deferred

Also ensure consistent option apply order with Vue 2, close vuejs#1016, close vuejs#1029
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants