rebuild hrm

This commit is contained in:
2026-04-13 09:30:59 +08:00
parent 44a98495ab
commit cd31c74da8
12034 changed files with 548007 additions and 451275 deletions

View File

@@ -11,26 +11,26 @@
*/
import {RefObject} from '@react-types/shared';
import {useEffect, useRef} from 'react';
import {useEffect} from 'react';
import {useEffectEvent} from './useEffectEvent';
export function useFormReset<T>(
ref: RefObject<HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement | null> | undefined,
initialValue: T,
onReset: (value: T) => void
) {
let resetValue = useRef(initialValue);
): void {
let handleReset = useEffectEvent(() => {
if (onReset) {
onReset(resetValue.current);
onReset(initialValue);
}
});
useEffect(() => {
let form = ref?.current?.form;
form?.addEventListener('reset', handleReset);
return () => {
form?.removeEventListener('reset', handleReset);
};
}, [ref, handleReset]);
}, [ref]);
}