Skip to content

Commit

Permalink
fix: add dirtySinceLastSubmit to field error subscription
Browse files Browse the repository at this point in the history
The field error misses a subscription to dirtySinceLastSubmit, which
might cause the error to show up again when the value is reverted to the
same value as the last submit value.

Added dirtySinceLastSubmit to subscription in FieldError.
  • Loading branch information
Gido Manders committed Sep 13, 2024
1 parent 490cb31 commit e590ba6
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/form/FormError/FieldError.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Field } from 'react-final-form';
import { FormError } from './FormError';
import React, { Dispatch, SetStateAction } from 'react';
import { FieldSubscription } from 'final-form';

export type ErrorMode = 'tooltip' | 'below';

Expand All @@ -18,11 +19,12 @@ export function FieldError({
errorMode
}: Props) {
// Listen to all props on the `Meta` object.
const errorSubscription = {
const errorSubscription: FieldSubscription = {
active: true,
touched: true,
error: true,
submitError: true,
dirtySinceLastSubmit: true,
value: true,
validating: true
};
Expand Down

0 comments on commit e590ba6

Please sign in to comment.