fix(react-form): subscribe to full meta object#1981
Open
ws-rush wants to merge 9 commits intoTanStack:mainfrom
Open
fix(react-form): subscribe to full meta object#1981ws-rush wants to merge 9 commits intoTanStack:mainfrom
ws-rush wants to merge 9 commits intoTanStack:mainfrom
Conversation
… custom meta properties This commit modifies `useField` to subscribe to the entire `state.meta` object instead of granular properties. This ensures that custom meta properties (like `hidden`) added by users trigger re-renders when updated. To mitigate performance regressions (specifically array fields re-rendering on every child update due to `isDirty`/`isTouched` refresh), `FormApi.setFieldValue` is optimized to skip `setFieldMeta` if the meta state is already correct. This ensures `meta` object reference stability when relevant state hasn't changed. Added regression test `tests/issue-1980.test.tsx`. Updated `tests/useField.test.tsx` to accommodate the slight behavior change (initial re-render due to `isDefaultValue` change).
🦋 Changeset detectedLatest commit: 9094f6b The changes in this PR will be included in the next version bump. This PR includes changesets to release 13 packages
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 |
… custom meta properties This commit modifies `useField` to subscribe to the entire `state.meta` object instead of granular properties. This ensures that custom meta properties (like `hidden`) added by users trigger re-renders when updated. To mitigate performance regressions (specifically array fields re-rendering on every child update due to `isDirty`/`isTouched` refresh), `FormApi.setFieldValue` is optimized to skip `setFieldMeta` if the meta state is already correct. This ensures `meta` object reference stability when relevant state hasn't changed. Added regression test `tests/issue-1980.test.tsx`. Updated `tests/useField.test.tsx` to accommodate the slight behavior change (initial re-render due to `isDefaultValue` change).
…' of https://github.com/wusabyRush/custom-field-meta into issue-1980-fix-custom-meta-updates-18083788771914964547
…' of https://github.com/wusabyRush/custom-field-meta into issue-1980-fix-custom-meta-updates-18083788771914964547
60c8c31 to
effb050
Compare
Merge Upstream Changes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes issue #1980 where custom field meta properties were not triggering updates in
useField.Replaced granular meta subscriptions with a full
state.metasubscription inuseFieldhook.Optimized
FormApi.setFieldValuein@tanstack/form-coreto avoid unnecessary meta updates, preserving performance optimizations for array fields.Added regression test and updated existing tests.
PR created automatically by Jules for task 18083788771914964547 started by @ws-rush