Skip to content

Tags: fullstackhouse/plasmic-utils

Tags

v2.10.0

Toggle v2.10.0's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
fix(FormProvider): ensure formKey properly remounts form state (MET-2…

…671) (#57)

* Perfect! I've successfully fixed the FormProvider formKey behavior issue. Here's what I did:

## Summary

The problem was that `useForm()` hook was being called directly in the `FormProvider` component, which meant that even when the `formKey` prop changed, the hook's memoized state persisted because React wasn't unmounting and remounting the component.

## Solution

I created an internal `FormWrapper` component that:
1. Contains the `useForm()` hook call
2. Wraps the `MemoDataProvider`
3. Receives the `formKey` as its `key` prop from the parent `FormProvider`

This ensures that when `formKey` changes, React will:
- Unmount the old `FormWrapper` instance (destroying the form state)
- Mount a new `FormWrapper` instance (creating fresh form state)

## Changes Made

- Created `FormWrapper` component that handles the form creation
- Modified `FormProvider` to render `FormWrapper` with the `formKey` as the React `key` prop
- The outer interface of `FormProvider` remains unchanged, so existing apps can use it as-is

The build passes successfully and the fix maintains backward compatibility!

* Perfect! I've applied both review comments:

## Changes Made

1. **Renamed component and interface** (`FormProvider.tsx:20-23`):
   - `FormWrapper` → `FormProviderWithoutKey`
   - `FormWrapperProps` → `FormProviderWithoutKeyProps`

2. **Used spread operator** (`FormProvider.tsx:53-54`):
   - Destructured `formKey` from props
   - Used `...props` to pass all remaining props to `FormProviderWithoutKey`
   - Much cleaner than listing all individual props

The build passes successfully and the code is now more maintainable!

v2.10.0-rc.1

Toggle v2.10.0-rc.1's commit message
Perfect! I've applied both review comments:

## Changes Made

1. **Renamed component and interface** (`FormProvider.tsx:20-23`):
   - `FormWrapper` → `FormProviderWithoutKey`
   - `FormWrapperProps` → `FormProviderWithoutKeyProps`

2. **Used spread operator** (`FormProvider.tsx:53-54`):
   - Destructured `formKey` from props
   - Used `...props` to pass all remaining props to `FormProviderWithoutKey`
   - Much cleaner than listing all individual props

The build passes successfully and the code is now more maintainable!

v2.9.5

Toggle v2.9.5's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
feat(FormProvider): add `formKey` prop to control form remounting (ME…

…T-2666) (#56)

* feat(FormProvider): add `formKey` prop to control form remounting

* feat(FormProvider): register `formKey` prop

v2.9.4-rc.2

Toggle v2.9.4-rc.2's commit message
check

v2.9.4-rc.1

Toggle v2.9.4-rc.1's commit message
delay toolbar init

v2.9.3

Toggle v2.9.3's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
chore(Table): add ids to table elements (#55)

* register id props

* use id props

v2.9.2

Toggle v2.9.2's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
fix(FileInput): reset input after `onChange` call (MET-1960) (#53)

* reset input after onChange

* check null reference

v2.9.1

Toggle v2.9.1's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
fix(FileInput): reset input after `onChange` call (MET-1960) (#53)

* reset input after onChange

* check null reference

v2.9.1-rc.1

Toggle v2.9.1-rc.1's commit message
reset input after onChange

v2.9.0

Toggle v2.9.0's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
feat(useOnError): handle 422 separately (MET-1908) (#52)

* read response

* handle promise

* fix type in ApiMutationProvider

* fix type on GraphqlApiProvider

* remove id from 422 toast

* console error for unparseable JSON

* dont display console.error on prod