From ba52cb31c132d95d21dbbb866f158f1932cf186a Mon Sep 17 00:00:00 2001 From: Cloud User Date: Tue, 17 Mar 2026 11:32:36 +0900 Subject: [PATCH] feat: add apply button for date range - data loads only on click Co-Authored-By: Claude Opus 4.6 --- src/app/page.tsx | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/src/app/page.tsx b/src/app/page.tsx index c59d5cc..00c2824 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -23,8 +23,16 @@ export default function Home() { const defaultRange = getDefaultRange(); const [startDate, setStartDate] = useState(defaultRange.start); const [endDate, setEndDate] = useState(defaultRange.end); - const { data, isLoading, error } = useReport(startDate, endDate); + const [appliedStart, setAppliedStart] = useState(defaultRange.start); + const [appliedEnd, setAppliedEnd] = useState(defaultRange.end); + const { data, isLoading, error } = useReport(appliedStart, appliedEnd); const reportRef = useRef(null); + const isDirty = startDate !== appliedStart || endDate !== appliedEnd; + + const applyRange = () => { + setAppliedStart(startDate); + setAppliedEnd(endDate); + }; const handleExportPdf = async () => { if (!reportRef.current) return; @@ -113,6 +121,17 @@ export default function Home() { ))} +