core icon indicating copy to clipboard operation
core copied to clipboard

fix(runtime-core): global mixin lifecyclehooks execute after component lifecyclehooks when use both Composition API and Options API

Open liulinboyi opened this issue 3 years ago • 4 comments

close #5918 fix(runtime-core): global mixin lifecyclehooks execute after component lifecyclehooks when use both Composition API and Options API

liulinboyi avatar May 16 '22 06:05 liulinboyi

Deploy Preview for vuejs-coverage failed.

Name Link
Latest commit 89be5ca5f3a18586f619992c9b00158081da6870
Latest deploy log https://app.netlify.com/sites/vuejs-coverage/deploys/6281fb4ad1cc3d0009507a4b

netlify[bot] avatar May 16 '22 06:05 netlify[bot]

Already tick the "allow edits from maintainer".

liulinboyi avatar May 16 '22 07:05 liulinboyi

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.

edison1105 avatar Oct 23 '24 06:10 edison1105

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.

skirtles-code avatar Jun 24 '25 11:06 skirtles-code