Context
After merging PR #62 for the Escrow Viewer PDF export feature, a few follow-up cleanup issues remain on main.
This task is intentionally small and focused. The goal is to improve production quality without changing escrow behavior or adding new product scope.
The Escrow Viewer is a read-only transparency surface. It should preserve clarity, avoid unnecessary console noise, handle errors safely, and provide good feedback when exporting reports.
Problem
Current issues observed on main:
src/components/escrow/EscrowDetails.tsx still disables @typescript-eslint/no-explicit-any and uses catch (err: any).
src/components/escrow/escrow-content.tsx imports error from next/error, then uses it in the welcome-state condition. This appears to be an incorrect import and may prevent the welcome state from behaving as intended.
src/components/escrow/title-card.tsx calls exportEscrowToPDF() directly without loading state, error handling, or user feedback.
Objective
Clean up the escrow viewer error state and PDF export UX after the PDF export merge.
Scope of Work
1. Remove unsafe any usage in EscrowDetails.tsx
- Remove the file-level eslint disable:
/* eslint-disable @typescript-eslint/no-explicit-any */
- Replace
catch (err: any) with safe unknown error handling.
- Prefer a small reusable helper if useful, for example:
const getErrorMessage = (error: unknown, fallback: string): string => {
if (error instanceof Error) return error.message;
if (typeof error === "string") return error;
return fallback;
};
- Use the helper in transaction fetching error handling.
2. Fix invalid error usage in escrow-content.tsx
import error from "next/error";
- Ensure
WelcomeState only appears when there is no organized escrow data and loading is false.
- If actual error state is needed in this component, pass it explicitly as a typed prop from
EscrowDetails.tsx.
- Do not depend on
next/error for UI state.
3. Improve PDF export button handling
In src/components/escrow/title-card.tsx:
- Add export loading state.
- Prevent duplicate clicks while export is running.
- Wrap
exportEscrowToPDF(organized, currentNetwork) in try/catch.
- Show user feedback with existing project UI patterns. The repo already has
sonner, so toast.success / toast.error is acceptable if consistent with the app.
- Disable the button when no organized escrow data is available or while exporting.
Suggested behavior:
- Button label changes to
Exporting... while generating.
- On success: show a success toast.
- On failure: show an error toast with a safe fallback message.
Non-Goals
- Do not change escrow fetching logic beyond the error handling cleanup.
- Do not change the PDF content structure.
- Do not add new PDF dependencies.
- Do not change escrow lifecycle logic.
- Do not add wallet interaction.
- Do not modify smart contract, API, or signing behavior.
Acceptance Criteria
Suggested Files
src/components/escrow/EscrowDetails.tsx
src/components/escrow/escrow-content.tsx
src/components/escrow/title-card.tsx
Optional:
Security / Product Notes
- Viewer must remain read-only.
- No wallet connection should be required.
- No escrow state should be modified.
- Avoid exposing unnecessary raw data in production logs.
- Keep testnet/mainnet behavior unchanged.
Recommended Validation
- Load the default viewer state and confirm the welcome state appears correctly.
- Load a valid escrow and confirm the details render.
- Export a PDF and confirm the button shows loading feedback.
- Try clicking export repeatedly and confirm duplicate exports are prevented.
- Temporarily simulate export failure and confirm the error feedback is shown.
- Run lint/type checks according to normal repo workflow if available.
Context
After merging PR #62 for the Escrow Viewer PDF export feature, a few follow-up cleanup issues remain on
main.This task is intentionally small and focused. The goal is to improve production quality without changing escrow behavior or adding new product scope.
The Escrow Viewer is a read-only transparency surface. It should preserve clarity, avoid unnecessary console noise, handle errors safely, and provide good feedback when exporting reports.
Problem
Current issues observed on
main:src/components/escrow/EscrowDetails.tsxstill disables@typescript-eslint/no-explicit-anyand usescatch (err: any).src/components/escrow/escrow-content.tsximportserrorfromnext/error, then uses it in the welcome-state condition. This appears to be an incorrect import and may prevent the welcome state from behaving as intended.src/components/escrow/title-card.tsxcallsexportEscrowToPDF()directly without loading state, error handling, or user feedback.Objective
Clean up the escrow viewer error state and PDF export UX after the PDF export merge.
Scope of Work
1. Remove unsafe
anyusage inEscrowDetails.tsx/* eslint-disable @typescript-eslint/no-explicit-any */catch (err: any)with safe unknown error handling.2. Fix invalid
errorusage inescrow-content.tsxWelcomeStateonly appears when there is no organized escrow data and loading is false.EscrowDetails.tsx.next/errorfor UI state.3. Improve PDF export button handling
In
src/components/escrow/title-card.tsx:exportEscrowToPDF(organized, currentNetwork)intry/catch.sonner, sotoast.success/toast.erroris acceptable if consistent with the app.Suggested behavior:
Exporting...while generating.Non-Goals
Acceptance Criteria
EscrowDetails.tsxno longer disables@typescript-eslint/no-explicit-any.catch (err: any)remains in the touched files.escrow-content.tsxno longer importserrorfromnext/error.Suggested Files
Optional:
Security / Product Notes
Recommended Validation