-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
undefined is not an object (evaluating 'e.slice') #601
Comments
there's a chance @CmdrRamon will understand, if @nosir doesn't see it first |
@ekilah I'm having the same issue, you can repro by right clicking an empty input field and pasting from clipboard - |
@hugobally oh cool, glad someone could figure out how to reproduce. If you want a fix and don't need the To add the fork in your
This fork reverts We'll see if the live version gets a fix, but until then, hope that helps! |
I was also able to reproduce this consistently by clicking into an empty cleave field, and then clicking on a different window altogether (off the browser). Note, this seems to only happen the first time you click into and then out of the empty field after the page initially renders and if you call setRawValue. getPostDelimiter gets called twice, the first time with value as undefined, the second time with the value passed to setRawValue. This does not happen if you set an initial value to the field of a non-empty string, as that fires the getPostDelimiter with that initial value on render. But an empty string '' does not fire getPostDelimiter. For now, I've had to fork this with the following code at the top of getPostDelimiter: |
Sounds like the repro steps are understood, but we get this from an extension one of our developers made that auto-fills in a form and just started getting this when we upgraded to 1.6. I'm going to downgrade to 1.5.10 where it looks like this error won't exist, until this issue is resolved! Thanks. |
Just to add another case for this, I'm getting what I think is a related bug when I try to use Enzyme's
This doesn't happen when using Cleave version 1.5.10, it was definitely introduced in 1.6.0. |
Also ran into this issue using 1.6.0 and I can confirm that downgrading until the issue has been resolved is an acceptable workaround. |
I encountered the same issue, but I did not want to downgrade the Cleave.js version. The issue is that import { ComponentProps } from 'react';
import Cleave from 'cleave.js/react';
const onInit: ComponentProps<typeof Cleave>['onInit'] = (owner) => {
(owner as any).lastInputValue = '';
};
const WrappedCleave = (props: any) => {
return (
<Cleave
onInit={onInit}
{...props}
/>
)
}; Now it works for me. Any comment would be welcome. |
The WrappedCleave component was a good idea, but it does not fix the issue I encountered with the getPostDelimiter function call being called twice with null followed by the value. |
Please read the whole thread. I posted a workaround above: #601 (comment) We've been using this workaround since I posted it, with no further issues. |
After upgrading to
1.6.0
from1.4.10
as a part of working around #593 , I have now seen this come up twice in bug reports:I haven't figured out how to reproduce it yet, but the relevant code seems to have been changed recently at #582
So far the bug has happened on this device:
The text was updated successfully, but these errors were encountered: