Date field not cleared in Tenant filter after clicking Clear button

This commit is contained in:
Kartik Sharma 2025-09-25 15:31:06 +05:30
parent 182280e91d
commit 16a23f6c27
2 changed files with 13 additions and 3 deletions

View File

@ -38,7 +38,7 @@ const TenantFilterPanel = ({ onApply }) => {
);
// Close popup when navigating to another component
// Close popup when navigating to another component
const location = useLocation();
useEffect(() => {
handleClosePanel();

View File

@ -148,10 +148,20 @@ export const DateRangePicker1 = ({
}, []);
useEffect(() => {
if (defaultRange && resetSignal !== undefined) {
if (resetSignal !== undefined) {
if (defaultRange) {
applyDefaultDates();
} else {
setValue(startField, "", { shouldValidate: true });
setValue(endField, "", { shouldValidate: true });
if (inputRef.current?._flatpickr) {
inputRef.current._flatpickr.clear();
}
}
}, [resetSignal, defaultRange]);
}
}, [resetSignal, defaultRange, setValue, startField, endField]);
const start = getValues(startField);
const end = getValues(endField);