Skip to content

Add a migration guide entry for renaming hook: to vnode- #857

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

Merged

Conversation

skirtles-code
Copy link
Contributor

@skirtles-code skirtles-code commented Feb 12, 2021

Vue 2 had lifecycle events, such as hook:mounted. These weren't really documented. The only mention of them in the official documentation that I can find is here: https://vuejs.org/v2/guide/components-edge-cases.html#Programmatic-Event-Listeners. Even that just shows them used in an example, with no direct explanation.

While they tend to be used very sparingly, they were used by a lot of projects, so it's worth having some guidance on migration.

In Vue 3, you can use events such as vnode-mounted to achieve a similar effect.

I've added an entry to the migration guide that describes this as a simple renaming. I'm not sure whether that's historically accurate but for practical purposes I think renaming will be enough to migrate code across.

The hook: events in Vue 2 didn't include any arguments/data with the event. If they had then it might make migrating more complicated. The vnode- events do include data but I don't think that needs to be mentioned for migration purposes.

This is related to #828, though more work is needed for that.

The vnode events are mentioned in a merged RFC.


Rendered: https://deploy-preview-857--vue-docs-next-preview.netlify.app/guide/migration/vnode-lifecycle-events.html

@skirtles-code skirtles-code marked this pull request as ready for review February 12, 2021 20:26
@NataliaTepluhina NataliaTepluhina merged commit 325b474 into vuejs:master Feb 24, 2021
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.

2 participants