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

v0.7+: $params values are null #302

Closed
laurentpayot opened this issue May 23, 2018 · 11 comments
Closed

v0.7+: $params values are null #302

laurentpayot opened this issue May 23, 2018 · 11 comments

Comments

@laurentpayot
Copy link

As you can see in the default fiddle the $params values are null:

{
  "text": {
    "required": false,
    "minLength": true,
    "$model": "",
    "$invalid": true,
    "$dirty": false,
    "$anyDirty": false,
    "$error": false,
    "$anyError": false,
    "$pending": false,
    "$params": {
      "required": null,
      "minLength": null
    }
  }

So using $v.text.$params.minLength.min like the docs say gives a type error.

This bug appeared in v0.7.0, it was working in v0.6.2.

@Frizi Frizi self-assigned this May 24, 2018
@Frizi
Copy link
Contributor

Frizi commented May 24, 2018

It seems like an issue only with the browser version, since all the tests are passing. I'll take a look and I'll add a test case for that.

@Frizi
Copy link
Contributor

Frizi commented May 24, 2018

Fix released as v0.7.4

@Frizi Frizi closed this as completed May 24, 2018
@Riplar
Copy link

Riplar commented Nov 12, 2018

Experiencing the same behavior with electron 3.0.8 and Vuelidate 0.7.4.

@larswww
Copy link

larswww commented Nov 15, 2018

Same issue here

Experiencing the same behavior with electron 3.0.8 and Vuelidate 0.7.4.

+1!

@oxid72
Copy link

oxid72 commented Nov 24, 2018

Same issue

@bartdominiak
Copy link

Can we reopen this issue? $params are null in 0.7.4

@kevintruby
Copy link

kevintruby commented Jan 7, 2019

Also having an issue with $params object in 0.7.4, using Vue 2.5.21 in a Laravel application.

Not sure if this matters, but the application is being bundled by Webpack via laravel-mix 4.0.12 -- according to my package-lock.json file the version of webpack installed is 4.28.3.

Otherwise loving this library though!

Edit:
On further investigation, this doesn't seem tied to the version of vuelidate specifically. This jsfiddle of mine is using 0.7.4 with edge Vue and appears to detect parameters just fine. I don't know what kind of build tools anyone else here is working with, but I'm guessing the issue in my implementation might come down to how my application is being built.

Follow-up Edit:
The solution for me turned out to be super simple; anyone having this same issue (with a similar build process) might want to consider trying this change. My application was attempting to load Vuelidate as an application-wide plugin:

import Vuelidate from 'vuelidate';
Vue.use(Vuelidate);

But if I remove this code, and use the following in the form component that ultimately needs to use it, the $params work again!

import { validationMixin } from 'vuelidate';

export default {
    ...
    mixins: [ validationMixin ],
    ...
}

Using the mixin didn't work until I removed the application-wide plugin declaration. Hope this helps!

@mankey-ru
Copy link

Also started to experience same problem with 0.7.4 on Electron after "npm update" which did not involve Vuelidate itself.

I tried to downgrade several packages including vue and vue-template-compiler but no success: I could not manage to detect the exact update due to complexity of app.

Anyway, global injection of plugins is evil; now, with mixin injection (HUGE thanks to @kevintruby ), code looks and works better.

@BernhardSchlegel
Copy link

My issue was a different one: My import looked like

import { minLength } from "vuelidate/src/validators";

while it really should be according to the documentation - the auto import of Webstorm screwed me :)

import { minLength } from 'vuelidate/lib/validators'

@sun-lau
Copy link

sun-lau commented Nov 12, 2020

same problem,$params value are null
faced on 0.7.6, browser-ready bundle.

The solution is include vuelidate.min.js before validators.min.js

@leonid-chernyavskiy
Copy link

This one needs to be on documentation or somewhere else (FAQ?)

Also, bug reappears when loading via async modules with webpack chunking enabled. Runtime selection of "withParams" would somehow make life easier:

src/withParamsBrowser.js, last export, change to:
export const withParams = function () { return (root.vuelidate ? root.vuelidate.withParams : fakeWithParams).apply(null, arguments); }

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 a pull request may close this issue.