fix(runtime-core): global mixin lifecyclehooks execute after component lifecyclehooks when use both Composition API and Options API
close #5918 fix(runtime-core): global mixin lifecyclehooks execute after component lifecyclehooks when use both Composition API and Options API
Deploy Preview for vuejs-coverage failed.
| Name | Link |
|---|---|
| Latest commit | 89be5ca5f3a18586f619992c9b00158081da6870 |
| Latest deploy log | https://app.netlify.com/sites/vuejs-coverage/deploys/6281fb4ad1cc3d0009507a4b |
Already tick the "allow edits from maintainer".
The reproduction in #5918 seems incorrect, but from the description, it appears that the Options API and Composition API are mixed, which is not recommended. The lifecycle hooks of the Options API are designed to run after the lifecycle hooks of the Composition API. Therefore, I think it does not need to be fixed.
I don't think there's a bug here. The exact execution order of mounted/onMounted isn't documented and I don't see a compelling reason why a global mixin should be given priority. While I can understand the reasoning that the global mixin is registered first, it could equally be argued that mounted consistently runs after onMounted, irrespective of where the mounted comes from.
Considering the extra code involved it doesn't seem worth changing it.