beforeUnmount in a mixin is not called when a component has beforeUnmount defined
Version
3.2.6
Reproduction link
[https://sfc.vuejs.org/#eyJBcHAudnVlIjoiPHNjcmlwdD5cbiAgaW1wb3J0IFdpdGhIb29rIGZyb20gJy4vV2l0aEhvb2sudnVlJztcbiAgaW1wb3J0IFdpdGhvdXRIb29rIGZyb20gJy4vV2l0aG91dEhvb2sudnVlJztcbiAgXG5leHBvcnQgZGVmYXVsdCB7XG4gIGNvbXBvbmVudHM6IHsgV2l0aEhvb2ssIFdpdGhvdXRIb29rIH0sXG4gIGRhdGE6ICgpID0 ICh7XG4gICAgc2hvd0NvbXA6IHRydWVcbiAgfSksXG59O1xuPC9zY3JpcHQ XG5cbjx0ZW1wbGF0ZT5cbiAgPGlucHV0IHR5cGU9XCJjaGVja2JveFwiIHYtbW9kZWw9XCJzaG93Q29tcFwiPlxuICA8V2l0aEhvb2sgdi1pZj1cInNob3dDb21wXCIgLz5cbiAgPFdpdGhvdXRIb29rIHYtaWY9XCJzaG93Q29tcFwiIC8 XG4gIDxkaXYgdi1lbHNlPlxuICAgIFVubW91bnRlZFxuICA8L2Rpdj5cbjwvdGVtcGxhdGU IiwiV2l0aG91dEhvb2sudnVlIjoiPHNjcmlwdD5cbmV4cG9ydCBkZWZhdWx0IHtcbiAgbWl4aW5zOiBbXG4gICAge1xuICAgICAgYmVmb3JlVW5tb3VudCgpIHtcbiAgICAgICAgY29uc29sZS5sb2coJ1dpdGhvdXRIb29rLm1peGluIGJlZm9yZVVubW91bnQnKTtcbiAgICAgIH0sXG4gICAgfSxcbiAgXSxcbn07XG48L3NjcmlwdD5cblxuPHRlbXBsYXRlPlxuICA8ZGl2PlxuICAgIFdpdGhvdXQgYmVmb3JlVW5tb3VudFxuICA8L2Rpdj5cbjwvdGVtcGxhdGU IiwiV2l0aEhvb2sudnVlIjoiPHNjcmlwdD5cbmV4cG9ydCBkZWZhdWx0IHtcbiAgbWl4aW5zOiBbXG4gICAge1xuICAgICAgYmVmb3JlVW5tb3V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ubW91bnQnKTtcbiAgICAgIH0sXG4gICAgfSxcbiAgXSxcbn07XG48L3NjcmlwdD5cblxuPHRlbXBsYXRlPlxuICA8ZGl2PlxuICAgIFdpdGhvdXQgYmVmb3JlVW5tb3VudFxuICA8L2Rpdj5cbjwvdGVtcGxhdGU IiwiV2l0aEhvb2sudnVlIjoiPHNjcmlwdD5cbmV4cG9ydCBkZWZhdWx0IHtcbiAgbWl4aW5zOiBbXG4gICAge1xuICAgICAgYmVmb3JlVW5tb3VudCgpIHtcbiAgICAgICAgY29uc29sZS5sb2coJ1dpdGhIb29rLm1peGluIGJlZm9yZVVubW91bnQnKTtcbiAgICAgIH0sXG4gICAgfSxcbiAgXSxcbiAgYmVmb3JlVW5tb3VudCgpIHtcbiAgICBjb25zb2xlLmxvZygnV2l0aEhvb2sgYmVmb3JlVW5tb3VudCcpO1xuICB9LFxufTtcbjwvc2NyaXB0PlxuXG48dGVtcGxhdGU XG4gIDxkaXY XG4gICAgV2l0aCBiZWZvcmVVbm1vdW50XG4gIDwvZGl2PlxuPC90ZW1wbGF0ZT4ifQ==)
Steps to reproduce
When we added a beforeUnmount
lifecycle hook to a component in our app, the beforeUnmount
lifecycle hook in a mixin in that component was no longer being called.
What is expected?
Based on the explanation in the API documentation, we expect that when a component implements a lifecycle hook and also uses a mixin with the same lifecycle hook, both should be called, with the mixin hooks being called first.
What is actually happening?
Adding a beforeUnmount lifecycle hook to a component prevents beforeUnmount lifecycle hooks from a mixin from being fired.
It appears that unmounted
and beforeUnmount
may be missing from internalOptionMergeStrats
:
See also this PR: https://github.com/vuejs/vue-next/pull/4447