remix-params-helper icon indicating copy to clipboard operation
remix-params-helper copied to clipboard

Unable to parse FormData params using prod build

Open corydeppen opened this issue 2 years ago • 2 comments

I've bumped into a strange issue that seems to only occur while running a prod build of the app. When running the app in dev, the FormData is parsed as expected, but in prod an empty object is returned. From what I've seen, it appears to be related to checking shape. In dev, shape is updated as expected, but in prod {} is returned because shape instanceof ZodObject || shape instanceof ZodEffects is falsy so shape isn't set correctly.

The following repo contains an example of what I'm seeing. Running npm run dev, entering a term on the "FormData Test" tab, and hitting Save will show the posted data correctly, while running npm run build && npm run preview will show an empty object after entering a term and hitting Save.

https://github.com/corydeppen/params-helper-sveltekit

corydeppen avatar Dec 30 '22 23:12 corydeppen

Interesting. Thanks for the bug report. I haven't seen that happen in my apps. I will definitely take a look.

kiliman avatar Dec 30 '22 23:12 kiliman

Yup same here! Gave me a good head scratcher 😆 (also SvelteKit)

multiplehats avatar Feb 06 '23 10:02 multiplehats