Skip to content

Commit bd37367

Browse files
majornistaCopilot
andcommitted
Update packages/@react-aria/form/src/useFormValidation.ts
Co-authored-by: Copilot <[email protected]>
1 parent 295b28a commit bd37367

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

packages/@react-aria/form/src/useFormValidation.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ export function useFormValidation<T>(props: FormValidationProps<T>, state: FormV
2828

2929
let timeoutId = useRef<ReturnType<typeof setTimeout> | null>(null);
3030
function announceErrorMessage(errorMessage: string = ''): void {
31-
clearTimeout(timeoutId.current!);
31+
if (timeoutId.current != null) {
32+
clearTimeout(timeoutId.current);
33+
}
3234
if (ref?.current &&
3335
errorMessage !== '' &&
3436
ref.current.contains(getActiveElement(getOwnerDocument(ref.current)))) {

0 commit comments

Comments
 (0)