ealush / vest

Vest ✅ Declarative validations framework

Home Page:https://vestjs.dev/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Suite test not working on IE11

mark-fajardo opened this issue · comments

I am really not sure but, recently I encountered issues regarding the implementation of vestjs on IE11, there are some issues with v3.2.7. Upgrading into ^4.0.0 fixed the issue.
But after that, it seems like the validations are not working with IE11. For example is when I use isTruthy, with a boolean true value, it returns a validation error. Are there any polyfills that I can use for this or I don't need any polyfill because it is just an issue with the plugin? Thank you in advance!

Btw, I am using Laravel with Vuejs on our project...

Hey @mark-fajardo, the issue is probably not with isTruthy itself, here's the entire function implementation:

export function isTruthy(value: unknown): boolean {
  return !!value;
}

Let's try to figure out what the issue could be. Can you please share a codesandbox with a repro and reproduction steps that I can play with? It will be much easier for me to debug it with a live reproduction of the bug.

Thanks!

Hello @ealush, maybe I can share a codesandbox of it. But before that, Yes, I think there is no problem with the isTruthy, as it is working with my Chrome. My problem was like, all of the validations are not working with IE11.
Do you think is there a problem in regards to polyfill?

This is my suite:

export const PreCheckSuite = create((data) => {
    test('taiwan_setup', '대만몰 미보유 상태입니다. 대만몰 생성후 신청해주세요', async () => {
        enforce(data['taiwan_setup']).isTruthy();
    });

   ...
});

Already tried logging the data and the value of taiwan_setup was true. But getErrors was returning errors and hasErrors was always true.

Addt'l. info:
The issue I've said earlier was this: https://stackoverflow.com/q/70607525/7837080
And it is now fixed by upgrading into v4.0.0

Thanks for your quick response!

Hi @ealush, sharing with you my sample code implementation of vestjs to my project.
https://codesandbox.io/s/rough-grass-9icx9?file=/src/main.js

This is working in Chrome, but not in IE 11.
Thank you in advance!

Hey @mark-fajardo, took me a while. It was pretty difficult for me to get to a ie11 setup that I can reproduce the issue in. I think I was finally able to track it down. From what it seems, this is not a polyfill problem, but an actual bug that only applies to ES5. I think I have a solution for it.

Can you please try installing vest@4.0.2-dev-72921c, this version contains this fix: https://github.com/ealush/vest/pull/772/files . From what I tested, it seems to work, while previous versions did not work.

Please let me know if that solves it for you. I already merged the fix, and it will be shipped with the next version of Vest within a few weeks, but until then, you can keep using vest@4.0.2-dev-72921c - apart from that fix, it is identical to the one you have installed, so there shouldn't be any drawbacks.

If you are interested in specific polyfills that may be relevant (but it doesn't seem so from your description):

  1. Object.assign
  2. Array.prototype.findIndex

But I wouldn't try to add them before testing that new version first.

Hi @ealush, tried to apply the vest@4.0.2-dev-72921c version, but sorry to tell you, this doesn't fix my issue.

Sorry for the late update, but in the meantime, I created a temporary validation file for our current project. But still waiting for the fix, as this is my favorite plugin for my validations in my other projects. Thanks for your effort!

@mark-fajardo hm. This is weird. I did see the bug you mentioned in vest@4.0.0, and I also noticed the error going away in vest@4.0.2-dev-72921c.

An example of Vest not working correctly on ie11

ie11-nw

An example of Vest working correctly on ie11

ie11w

Can you please try reinstalling 4.0.2-dev-72921c and log the version to see if it was installed correctly?

console.log(vest.VERSION);

Ah. I think I understand why you didn't get the fix. The fix is within the n4s package, which should be updated separately. I am releasing another version now, and I believe it will then have the fix available to you. Should be out within 20 minutes, and I will send the version number here.

@mark-fajardo, I just published vest@4.0.2-next-adfb43, which is the same as the previous fixed version, only this time I am also bumping the enforce version as well. Please let me know if it works now.

npm i vest@4.0.2-next-adfb43

Hi @ealush, the package vest@4.0.2-next-adfb43 is now working on my IE. Greatly appreciated! Thanks for your help! 🥂

Awesome. I'll add it to the public version in about a week or so. All you have to do is upgrade to 4.1.0 next week.

Okay, this is noted. Thanks again!