From 9a48040c562d28c3e8a1e0057df886b7d9f053ab Mon Sep 17 00:00:00 2001 From: LeCarbonator <18158911+LeCarbonator@users.noreply.github.com> Date: Mon, 22 Dec 2025 09:18:21 +0100 Subject: [PATCH 1/3] chore(form-core): use conditional chains again --- packages/form-core/src/FormApi.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/packages/form-core/src/FormApi.ts b/packages/form-core/src/FormApi.ts index 5b1ec5e17..ff52bbe74 100644 --- a/packages/form-core/src/FormApi.ts +++ b/packages/form-core/src/FormApi.ts @@ -1696,8 +1696,11 @@ export class FormApi< determineFormLevelErrorSourceAndValue({ newFormValidatorError, isPreviousErrorFromFormValidator: - currentErrorMapSource[errorMapKey] === 'form', - previousErrorValue: currentErrorMap[errorMapKey], + // These conditional checks are required, otherwise we get runtime errors. + // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition + currentErrorMapSource?.[errorMapKey] === 'form', + // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition + previousErrorValue: currentErrorMap?.[errorMapKey], }) if (newSource === 'form') { @@ -1707,7 +1710,9 @@ export class FormApi< } } - if (currentErrorMap[errorMapKey] !== newErrorValue) { + // This conditional check is required, otherwise we get runtime errors. + // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition + if (currentErrorMap?.[errorMapKey] !== newErrorValue) { this.setFieldMeta(field, (prev = defaultFieldMeta) => ({ ...prev, errorMap: { From 7f77f32ad4bc4fe6ad4c8a39748d5aaab89e3c03 Mon Sep 17 00:00:00 2001 From: LeCarbonator <18158911+LeCarbonator@users.noreply.github.com> Date: Mon, 22 Dec 2025 09:20:33 +0100 Subject: [PATCH 2/3] Fix runtime errors in form-core validation Prevent runtime errors that occur during form validation in the form-core package. --- .changeset/dull-bees-draw.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/dull-bees-draw.md diff --git a/.changeset/dull-bees-draw.md b/.changeset/dull-bees-draw.md new file mode 100644 index 000000000..57c06e9ee --- /dev/null +++ b/.changeset/dull-bees-draw.md @@ -0,0 +1,5 @@ +--- +"@tanstack/form-core": patch +--- + +fix(form-core): Prevent runtime errors during validation From f68391ca10a176c6787e7abe334eb625779e01bb Mon Sep 17 00:00:00 2001 From: "autofix-ci[bot]" <114827586+autofix-ci[bot]@users.noreply.github.com> Date: Mon, 22 Dec 2025 08:21:20 +0000 Subject: [PATCH 3/3] ci: apply automated fixes and generate docs --- .changeset/dull-bees-draw.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changeset/dull-bees-draw.md b/.changeset/dull-bees-draw.md index 57c06e9ee..8a09ca242 100644 --- a/.changeset/dull-bees-draw.md +++ b/.changeset/dull-bees-draw.md @@ -1,5 +1,5 @@ --- -"@tanstack/form-core": patch +'@tanstack/form-core': patch --- fix(form-core): Prevent runtime errors during validation