2.5.2
https://codesandbox.io/s/ympx4pk72z
1、click the home link
2、click the test link
after the Home component destroyed,its updated hook should not be called
after the Home component destroyed,its updated hook is called
here is the log information
Home beforeCreate
Home created
Home beforeMount
Home mounted
Test beforeCreate
Test created
Test beforeMount
Home beforeDestroy
Home destroyed
Test mounted
Home updated
why the Home component can call updated hook after it is destroyed?
Is Vue designed to do so?
@BL-Lac149597870 In your reproduction link, you have not defined your components as .vue component.
@mbj36 my bad.Now i have just corrected the mistake and changed the repo link,but the problem still remains...
@BL-Lac149597870 It's always better to use computed property or watcher - See the api docs here - https://vuejs.org/v2/api/#updated
@mbj36 Thank you for your reply. But I didn't perform any DOM-dependent operations when the updated hook was called.And according to Vue lifecycle,after one component is destroyed,its updated hook shouldn't be called.But in my repo,this condition happens.I can't figure out how this happens.
Met this problem, too.
Any news for this?😂
@BL-Lac149597870
@shockw4ver Maybe we can work it out together,hahaha~
I hate to bring bad news, but the fix only triggers the update part of the lifecycle, leaving beforeUpdate still being invoked after the component is destroyed.
Use the sandbox above with "vue": "^2.5.18-beta.0", to verify
(xposted on the PR accepted)
Most helpful comment
@mbj36 Thank you for your reply. But I didn't perform any DOM-dependent operations when the updated hook was called.And according to Vue lifecycle,after one component is destroyed,its updated hook shouldn't be called.But in my repo,this condition happens.I can't figure out how this happens.