Open glassworks-projects opened 2 months ago
Hi. I can see that you've described your issue in much detail but that's also a "cons" because I personally won't bother reading though that. The bottom line in general is: library maintainers can only look at minimal reproducible sandboxes, and that usually means plain javascript + the library as the only included dependency.
Hi. I can see that you've described your issue in much detail but that's also a "cons" because I personally won't bother reading though that. The bottom line in general is: library maintainers can only look at minimal reproducible sandboxes, and that usually means plain javascript + the library as the only included dependency.
super unhelpful, thanks so much 😇
A bug so bizarre that it must be because I'm doing something simple wrong, but here goes:
I have a full stack react app in which phone numbers can be added to a database using a form or via CSV upload. Here's my validation schema:
On the frontend, I've got a
react-hook-form
using the schema:And then I'm using a
<PhoneInput />
element from react-phone-number-input to collect the number.For the CSV upload, I am passing the value as text to a tRPC mutation because tRPC doesn't handle multipart/form-data requests. (Maybe this is the problem?)
Tried to be as exhaustive as I could here, but omitted some things for brevity, lmk if you need clarification on anything.
With this setup, when I pass a valid US phone number (a real phone number taken from my contacts) via the form, the validation passes. When I pass that same phone number in a CSV, validation fails. Anyone got any ideas for me? the LLMs have failed me, and I can't really figure out how to debug further. My best guess is that it has something to do with how I'm passing data to the tRPC route, but I can't rule out that it's an issue with the validator function itself, so I'm posting here.
I did try manually testing one of the
records
inparseCsv
to confirm that the check really is returning false, and it is:Note: I was originally importing
isValidPhoneNumber
from"react-phone-number-input"
, but since that package just exports that function from this one, I'm posting here. I changed the import (as you can see above) and confirmed the same behavior.