Skip to content
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

Support @vue/compat + VeeValidate v3 #3992

Closed
m-demydiuk opened this issue Nov 10, 2022 · 5 comments
Closed

Support @vue/compat + VeeValidate v3 #3992

m-demydiuk opened this issue Nov 10, 2022 · 5 comments

Comments

@m-demydiuk
Copy link

Is your feature request related to a problem? Please describe.

We have a very big project and we use next:

  • Vue v2.6.14
  • BootstrapVue v2.23
  • VeeValidate v3.4.14

We started to think to migrate our project to Vue 3.

  • Vue team introduced @vue/compat - to make it easier to migrate from vue 2 to vue 3
  • BootstrapVue team also introduced new version that uses @vue/compat and makes it easier to migrate to vue 3

But now we stuck, because seems vee validate v3 is not compatibale with @vue/compat, because:
https://v3-migration.vuejs.org/migration-build.html#known-limitations

Known Limitations
- Dependencies that rely on Vue 2 internal APIs or undocumented behavior. The most common case is usage of private properties on VNodes. If your project relies on component libraries like [Vuetify](https://vuetifyjs.com/en/), [Quasar](https://quasar.dev/) or [ElementUI](https://element.eleme.io/#/en-US), it is best to wait for their Vue 3 compatible versions.

And we have this issue:
image
image
image

Describe the solution you'd like

Are there any possibilities, that vee validate v3 will become compatible with @vue/compat ?

@mcube27
Copy link

mcube27 commented Nov 10, 2022

Same issue.
It's a jard job to migrate. It could be very helpfull to migrate vee-validate once our own code is fixed !

@logaretm
Copy link
Owner

logaretm commented Nov 13, 2022

The main problem is that vee-validate v3 has relied on exactly that. The VNode private API. Which is now completely different. And it worked well till some early alphas of Vue 3 where a change to directive representation in VNode completely killed that possibility.

To elaborate, vee-validate v3 relies on walking the node tree and trying to locate any nodes with v-model applied to them. It did a lot of black magic to make it work. With Vue 3 VNode API, you cannot find nodes with v-model anymore because there is no way to identify the directives anymore. Basically v-model in Vue 3 looks the same as any other directive object in the VNode API.

Now vee-validate v4 does a better job since it uses public APIs of Vue.js to achieve almost the same feature set. That sadly means there is no direct upgrade path between v3 and v4 in that regard.

If there was something I can do I would have done it by now, but there is no way the old API works in Vue 3. No compatibility hacks or workarounds. This means a new vee-validate had to be built from scratch which is what happened with v4.

For other libraries, it is straightforward as long as they find alternatives to the APIs they use. But this is not the case here. The one thing v3 relied upon was identifying directives and that's gone out of the window. The silver lining is we ended up with a much better API but at the cost of some effort to re-write or migrate.

I'm writing a migration guide, but that's just that. a guide that will take you through how to get the same functionality working again with some changes and some conversion examples. Basically, it would tell you how to re-write v3 code in v4. It won't be 100% foolproof and will probably be lacking for a lot of use cases but it should help a bit.

Closing but feel free to continue the discussion or send suggestions.

@logaretm logaretm closed this as not planned Won't fix, can't repro, duplicate, stale Nov 13, 2022
@fazulk
Copy link

fazulk commented Apr 7, 2023

Any update on the migration guide?

@stephane303
Copy link

@logaretm Can we find the migration guide anywhere ?

@bedus-creation
Copy link

Similar case with for VeeValidate 2.x

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants