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

[Bug]: Error when using with Immer 10 #312

Open
1 of 4 tasks
Minivera opened this issue Aug 7, 2023 · 9 comments
Open
1 of 4 tasks

[Bug]: Error when using with Immer 10 #312

Minivera opened this issue Aug 7, 2023 · 9 comments
Labels
bug Something isn't working

Comments

@Minivera
Copy link

Minivera commented Aug 7, 2023

Which packages are impacted?

  • remix-validated-form
  • @remix-validated-form/with-zod
  • @remix-validated-form/with-yup
  • zod-form-data

What version of these packages are you using?

  • remix-validated-form: ^5.0.1
  • @remix-validated-form/with-zod: ^2.0.6
  • immer: ^10.0.2

Please provide a link to a minimal reproduction of the issue.

https://codesandbox.io/p/sandbox/amazing-frost-2g4gy4

Steps to Reproduce the Bug or Issue

  1. Open the demo on codesandbox and start the app
  2. See the crash on load

Expected behavior

I would expect the library to work with any version of immer installed locally, since the library should export its own version of immer? Seems like NPM is picking up the locally installed version instead, and the library does not support v10.

Screenshots or Videos

No response

Platform

  • OS: Windows
  • Browser: Chrome
  • Version: 114.0.5735.199

Additional context

No response

@Minivera Minivera added the bug Something isn't working label Aug 7, 2023
@airjp73
Copy link
Owner

airjp73 commented Aug 11, 2023

Looks like zustand has immer as a peer dependency and it is picking up the local version of immer. I don't think it makes sense for immer to be a required peer dependency of this library so I'll have to dig a bit to figure out the best solution for this. Maybe there's a way to force zustand to resolve to RVF's version of immer.

Screenshot 2023-08-11 at 12 01 54 PM

@Minivera
Copy link
Author

Would it make sense to update the version of immer of the library to v10? I'm not sure what the breaking changes are yet, but I could try making a PR for it if it helps.

@airjp73
Copy link
Owner

airjp73 commented Aug 22, 2023

Could you try it with version 5.1.1-beta.0 to see if that fixes the error?

@Minivera
Copy link
Author

👍 Will do and then let you know

@Minivera
Copy link
Author

Minivera commented Aug 24, 2023

It works great on the codesandbox, will try on our app locally then edit this comment: https://codesandbox.io/p/sandbox/heuristic-firefly-4y96td

EDIT:

On our local application, I'm seeing this error in the page where the form is used. I'll try to dig into it and provide a reproduction:

Uncaught Error: Dynamic require of "react" is not supported
    at chunk-73CLBT4D.js:13:9
    at with-selector.development.js:26:23
    at ../../node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js (with-selector.development.js:164:3)
    at __require22 (fieldArray.tsx:196:10)
    at ../../node_modules/use-sync-external-store/shim/with-selector.js (with-selector.js:6:20)
    at __require22 (fieldArray.tsx:196:10)
    at index.mjs:4:41

@airjp73
Copy link
Owner

airjp73 commented Sep 22, 2023

Hi! Sorry for the slow turnaround. Could you post a reproduction of the new error so I can debug it?

@airjp73
Copy link
Owner

airjp73 commented Sep 22, 2023

The initial fix is now released in 5.1.2.

@airjp73
Copy link
Owner

airjp73 commented Sep 22, 2023

Nevermind, I've managed to reproduce the issue. I've rolled back the initial fix in 5.1.3 because of the dynamic require issue.

@Minivera
Copy link
Author

I wasn't able to reproduce the issue in a codesandbox and could not figure out why it was failing in our local app, so we've moved forward with locking our own version of immer for now. Do you have a sandbox where you managed to reproduce the issue? I'd be curious as to what caused it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants