fabian-hiller / modular-forms

The modular and type-safe form library for SolidJS, Qwik and Preact
https://modularforms.dev
MIT License
979 stars 52 forks source link

[React]: Preact Signals Dependency Update #188

Open ps73 opened 6 months ago

ps73 commented 6 months ago

I am using preact signals in my react app und currently using v2. This lib uses v1. It would be great if @preact/signals could be upgraded to v2.

fabian-hiller commented 6 months ago

Thank you for the info. I will investigate v2 in the next days and publish a new version.

fabian-hiller commented 6 months ago

What happens if you ignore the peer dependency warning? Does Modular Forms still work as expected in development and production mode?

ps73 commented 6 months ago

I think a babel plugin is needed to get v2 working correctly.

https://github.com/preactjs/signals/tree/main/packages/react#babel-transform

fabian-hiller commented 5 months ago

Does Modular Forms still work as expected if you ignore the peer dependency warning? I am asking to find out if this is only necessary for end users.

ps73 commented 5 months ago

It didn't work for me. For example {field.error.value} didn't rerender on validation error.

fabian-hiller commented 5 months ago

After you added the Bable plugin?

ps73 commented 5 months ago

Yeah added babel plugin to vite config inside the react plugin and couldn't make it work fastly. But I had not that much time to debug it.

fabian-hiller commented 5 months ago

Ok. Feel free to add the Bable plugin to this repo in packages/react and see if it works.

awhitford commented 5 months ago

I updated the @preact/signals-react dependency from ^1.3.4 to ^2.0.0. and the pnpm install gave the following warnings:

WARN  Issues with peer dependencies found
playgrounds/qwik
└─┬ vite-tsconfig-paths 4.3.1
  └─┬ tsconfck 3.0.1
    └── ✕ unmet peer typescript@^5.0.0: found 4.9.5

playgrounds/solid
└─┬ solid-start 0.2.26
  └── ✕ unmet peer vite@^4.1.4: found 3.2.5

website
└─┬ solid-start 0.2.26
  └── ✕ unmet peer vite@^4.1.4: found 3.2.5

However, the React Playground seems to be working fine. I don't see a problem with field errors.

ps73 commented 5 months ago

Cannot confirm this @awhitford.

When passing field.error.value down as a prop, it will not be changed when using v2 with or without the babel plugin: https://stackblitz.com/edit/vitejs-vite-otlhs7?file=src%2FApp.tsx

When using v1.3.8 it works as expected: https://stackblitz.com/edit/vitejs-vite-7tjm6f?file=src/App.tsx

fabian-hiller commented 5 months ago

I will check and merge PR #191 tomorrow or in the next few days.