fix(tenders): clear documents scraped checkbox on filter reset
continuous-integration/drone/push Build is passing

Control the checkbox through react-hook-form so Reset all updates the UI, and normalize documents_scraped to false when rebuilding filter state.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
AmirReza Jamali
2026-07-13 15:20:53 +03:30
parent 209acea88a
commit b87cf35f08
2 changed files with 18 additions and 6 deletions
@@ -13,6 +13,7 @@ import { isDateRangeActive } from "@/utils/shared";
import { useMemo } from "react";
import {
Control,
Controller,
FieldValues,
UseFormHandleSubmit,
UseFormRegister,
@@ -214,12 +215,22 @@ const TenderListFilters = ({
subtitle="Restrict to tenders whose documents have been scraped."
>
<div className="max-w-fit rounded-xl border border-stroke/40 bg-white/60 p-4 dark:border-white/[0.06] dark:bg-dark-3/40">
<Controller
name="documents_scraped"
control={control}
render={({ field: { value, onChange, name, onBlur, ref } }) => (
<Checkbox
ref={ref}
name={name}
label="Documents scraped"
minimal
withBg
withIcon="check"
{...filterRegister("documents_scraped")}
checked={value === true}
onBlur={onBlur}
onChange={(event) => onChange(event.target.checked)}
/>
)}
/>
</div>
</CollapsibleFilterSection>
@@ -179,6 +179,7 @@ const mergeTenderFilterFormState = (params: Record<string, any>) => {
return {
...TENDER_FILTER_FORM_DEFAULTS,
...built,
documents_scraped: built.documents_scraped === true,
created_at_range: built.created_at_range ?? [],
tender_deadline_range: built.tender_deadline_range ?? [],
publication_date_range: built.publication_date_range ?? [],