Skip to content

perf(form-core): extract meta markers to state object (v2) - #2269

Merged
LeCarbonator merged 1 commit into
TanStack:alphafrom
43081j:jg/meta-magic
Aug 4, 2026
Merged

perf(form-core): extract meta markers to state object (v2)#2269
LeCarbonator merged 1 commit into
TanStack:alphafrom
43081j:jg/meta-magic

Conversation

@43081j

@43081j 43081j commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

In order to compute if we can re-use the previous meta, we currently tag
two properties onto the meta (derivedMetaSourceKey,
derivedMetaCanDisplayErrorsKey).

This is fairly expensive because it means we change the shape of an
otherwise consistently structured object each time the value changes.

We only make use of this when the value changes, so this change switches
to using a markers object which transitions between values.

Basically this pattern:

const markers = { ... };

createAtom((prev) => {
  // in here, mutate `markers` when prev != curr
});

This means the underlying meta object never changes shape.

Also important to note, this now means getFieldSnapshot doesn't even
pass through this code path anymore.

NOTE: there's also a bit of a drive-by in here. I updated
nameToFieldNodeSegments to slice between separators instead of
appending characters one-by-one. Much faster, but can be split into its
own PR if needed.

✅ Checklist

  • I have followed the steps in the Contributing guide.
  • I have tested this code locally with pnpm test:pr.

🚀 Release Impact

  • This change affects published code, and I have generated a changeset.
  • This change is docs/CI/dev-only (no release).

@coderabbitai

coderabbitai Bot commented Aug 3, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 56bb9d4e-16a9-4441-bd56-97c97711250d

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

In order to compute if we can re-use the previous meta, we currently tag
two properties onto the meta (`derivedMetaSourceKey`,
`derivedMetaCanDisplayErrorsKey`).

This is fairly expensive because it means we change the shape of an
otherwise consistently structured object each time the value changes.

We only make use of this when the value changes, so this change switches
to using a `markers` object which transitions between values.

Basically this pattern:

```ts
const markers = { ... };

createAtom((prev) => {
  // in here, mutate `markers` when prev != curr
});
```

This means the underlying meta object never changes shape.

Also important to note, this now means `getFieldSnapshot` doesn't even
pass through this code path anymore.

NOTE: there's also a bit of a drive-by in here. I updated
`nameToFieldNodeSegments` to slice between separators instead of
appending characters one-by-one. Much faster, but can be split into its
own PR if needed.
@nx-cloud

nx-cloud Bot commented Aug 4, 2026

Copy link
Copy Markdown

View your CI Pipeline Execution ↗ for commit 9f4521a

Command Status Duration Result
nx affected --targets=test:sherif,test:knip,tes... ✅ Succeeded 2m 46s View ↗
nx run-many --target=build --exclude=examples/** ✅ Succeeded 21s View ↗

☁️ Nx Cloud last updated this comment at 2026-08-04 05:46:36 UTC

@pkg-pr-new

pkg-pr-new Bot commented Aug 4, 2026

Copy link
Copy Markdown
More templates

@tanstack/angular-form

npm i https://pkg.pr.new/@tanstack/angular-form@2269

@tanstack/form-core

npm i https://pkg.pr.new/@tanstack/form-core@2269

@tanstack/form-devtools

npm i https://pkg.pr.new/@tanstack/form-devtools@2269

@tanstack/lit-form

npm i https://pkg.pr.new/@tanstack/lit-form@2269

@tanstack/preact-form

npm i https://pkg.pr.new/@tanstack/preact-form@2269

@tanstack/react-form

npm i https://pkg.pr.new/@tanstack/react-form@2269

@tanstack/react-form-devtools

npm i https://pkg.pr.new/@tanstack/react-form-devtools@2269

@tanstack/react-form-nextjs

npm i https://pkg.pr.new/@tanstack/react-form-nextjs@2269

@tanstack/react-form-start

npm i https://pkg.pr.new/@tanstack/react-form-start@2269

@tanstack/solid-form

npm i https://pkg.pr.new/@tanstack/solid-form@2269

@tanstack/solid-form-devtools

npm i https://pkg.pr.new/@tanstack/solid-form-devtools@2269

@tanstack/svelte-form

npm i https://pkg.pr.new/@tanstack/svelte-form@2269

@tanstack/vue-form

npm i https://pkg.pr.new/@tanstack/vue-form@2269

commit: 9f4521a

@LeCarbonator
LeCarbonator merged commit 1620181 into TanStack:alpha Aug 4, 2026
9 checks passed
@LeCarbonator

Copy link
Copy Markdown
Contributor

Thanks!

@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (alpha@cfb2ebe). Learn more about missing BASE report.
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@           Coverage Diff            @@
##             alpha    #2269   +/-   ##
========================================
  Coverage         ?   96.06%           
========================================
  Files            ?       28           
  Lines            ?     2669           
  Branches         ?      743           
========================================
  Hits             ?     2564           
  Misses           ?       99           
  Partials         ?        6           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions github-actions Bot mentioned this pull request Aug 4, 2026
@43081j
43081j deleted the jg/meta-magic branch August 4, 2026 06:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants