edmundhung / conform

A type-safe form validation library utilizing web fundamentals to progressively enhance HTML Forms with full support for server frameworks like Remix and Next.js.
https://conform.guide
MIT License
1.98k stars 107 forks source link

fix: `FormValue` should never be `null` #719

Closed aaronadamsCA closed 1 month ago

aaronadamsCA commented 3 months ago

It looks like I made a mistake in #508 when I widened FormValue to include null in some cases. I'm reasonably confident a field's initialValue will never be null.

I noticed this when I created a component that takes name: FieldName<string | object>. You can see the strange behaviour here:

TypeScript Playground

You can see what happened when I ran git blame here:

![image](https://github.com/user-attachments/assets/40893c88-bad9-4be0-928c-ac47099a582c)

Since this is a one-line change, I'm just submitting it through the GitHub UI to confirm the tests will pass.

changeset-bot[bot] commented 3 months ago

🦋 Changeset detected

Latest commit: 7aae87a07567384f1b7d05ecadd2135f8f2f0d97

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 4 packages | Name | Type | | ----------------- | ----- | | @conform-to/dom | Patch | | @conform-to/react | Patch | | @conform-to/yup | Patch | | @conform-to/zod | Patch |

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

pkg-pr-new[bot] commented 2 months ago

commit: 7aae87a

@conform-to/dom

``` pnpm add https://pkg.pr.new/@conform-to/dom@719 ```

@conform-to/react

``` pnpm add https://pkg.pr.new/@conform-to/react@719 ```

@conform-to/validitystate

``` pnpm add https://pkg.pr.new/@conform-to/validitystate@719 ```

@conform-to/yup

``` pnpm add https://pkg.pr.new/@conform-to/yup@719 ```

@conform-to/zod

``` pnpm add https://pkg.pr.new/@conform-to/zod@719 ```

Open in Stackblitz

More templates

- [@conform-example/chakra-ui](https://pkg.pr.new/template/ee6e6cac-0b1c-4e64-ae02-77e4bc006bc2) - [@conform-example/headless-ui](https://pkg.pr.new/template/1ecc22fe-6686-4e56-809d-88a3afbfeefb) - [@conform-example/material-ui](https://pkg.pr.new/template/a613d4ff-f1e1-4477-88ed-6c74ac95904a) - [@conform-example/nextjs](https://pkg.pr.new/template/3f9c066b-c8f5-4033-8d99-d90f788ee0d9) - [@conform-example/radix-ui](https://pkg.pr.new/template/32760d45-ddf9-4c40-8044-9ed2528fd98c) - [@conform-example/react-router](https://pkg.pr.new/template/af0b34dd-dac8-44e7-87e9-1cf85d70b54f) - [@conform-example/remix](https://pkg.pr.new/template/88a9cf5b-bb12-4f5c-9669-391e0a1d3f37) - [@conform-example/shadcn-ui](https://pkg.pr.new/template/f9e01714-14d4-40b1-a08b-abfd0d08d01d)