diff --git a/components/estimator/estimate-pdf.tsx b/components/estimator/estimate-pdf.tsx index 024275a..f4831c9 100644 --- a/components/estimator/estimate-pdf.tsx +++ b/components/estimator/estimate-pdf.tsx @@ -2,6 +2,7 @@ // SPDX-License-Identifier: AGPL-3.0-or-later // Copyright (C) 2026 Steel-Tech / StructuPath +import { useMemo } from "react"; import { Printer } from "lucide-react"; import { formatCurrency, formatCurrencyPrecise } from "@/lib/estimator/calculate"; import type { EstimateInput, EstimateResult } from "@/lib/types/estimator"; @@ -18,11 +19,19 @@ export function EstimatePdf({ result, companyName = "IronForge Estimator", }: Props) { - const today = new Date().toLocaleDateString("en-US", { - year: "numeric", - month: "long", - day: "numeric", - }); + // Stamp the date + estimate id once at mount — computing them during render + // is impure (the id would change on every re-render). + const { today, estimateId } = useMemo(() => { + const now = new Date(); + return { + today: now.toLocaleDateString("en-US", { + year: "numeric", + month: "long", + day: "numeric", + }), + estimateId: now.getTime().toString().slice(-6), + }; + }, []); const stateData = input.state ? STATE_REGISTRY[input.state] : undefined; function handlePrint() { @@ -52,8 +61,7 @@ export function EstimatePdf({ Date: {today}
- Estimate #: EST- - {Date.now().toString().slice(-6)} + Estimate #: EST-{estimateId}
diff --git a/components/estimator/estimate-results.tsx b/components/estimator/estimate-results.tsx index 41a1e15..324069f 100644 --- a/components/estimator/estimate-results.tsx +++ b/components/estimator/estimate-results.tsx @@ -34,7 +34,7 @@ export function EstimateResults({ input, result }: Props) {
- // Total Bid Estimate + {"// Total Bid Estimate"}
diff --git a/components/ui/error-boundary.tsx b/components/ui/error-boundary.tsx index 104ae18..91c39b7 100644 --- a/components/ui/error-boundary.tsx +++ b/components/ui/error-boundary.tsx @@ -32,7 +32,6 @@ export class ErrorBoundary extends Component Date.now()); const thirty = 30 * 86_400_000; const seven = 7 * 86_400_000;