diff --git a/AUDIT_LOG.md b/AUDIT_LOG.md index 0105e16..e91724f 100644 --- a/AUDIT_LOG.md +++ b/AUDIT_LOG.md @@ -2,6 +2,19 @@ This log tracks all significant changes, updates, and versions in the PaperCache project. +## 2026-06-27 (Update) +**Change:** fix: resolve TypeScript strict build errors in GraphView and setupTests + +**Details/Why:** +Resolved production build (`npm run tauri build` / `tsc -b`) failures caused by strict typing mismatches: +1. **`ForceGraphMethods` Typing (`GraphView.tsx`)** — Configured `ForceGraphInstance` to extend `ForceGraphMethods` imported from `react-force-graph-3d`, enabling type-safe calls to `d3Force`, `strength`, `d3ReheatSimulation`, and `cameraPosition`. +2. **Ref Variance (`GraphView.tsx`)** — Casted `` ref prop to resolve strict `MutableRefObject` variance mismatch. +3. **Mock Contract (`setupTests.ts`)** — Added missing `onUpdateReady` mock implementation to `window.electronAPI` in unit test environment setup. + +**Files changed:** `src/GraphView.tsx`, `src/setupTests.ts`, `AUDIT_LOG.md`, `CHANGELOG.md`. + +--- + ## 2026-06-27 **Change:** fix: address audit findings — ESC logic, IPC types, update UX, mutex safety, ESLint (PR #68) diff --git a/CHANGELOG.md b/CHANGELOG.md index a6c8b31..02b6e8e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - **IPC error handling for shell/file commands**: `openExternal`, `openFile`, `setLaunchAtStartup`, and `quitApp` now properly propagate backend errors to the caller instead of silently discarding the Promise. - **Update notification before restart**: When an auto-update is ready, PaperCache now shows a toast ("PaperCache updated — restarting in 3 seconds…") for 3 seconds before restarting, so users are never caught off-guard. - **Pause button removed from timer panel**: The ⏸ pause button had no corresponding resume path (backend not implemented). Removed to avoid a dead-end UX; the close/remove button remains. +- **Resolved production build TypeScript errors**: Fixed strict compilation failures in GraphView (`d3Force`, `cameraPosition`, ref assignment) and unit test setup (`onUpdateReady`). ## [v0.5.3] - 2026-06-24 diff --git a/src/GraphView.tsx b/src/GraphView.tsx index 5dcf6cb..cf6abce 100644 --- a/src/GraphView.tsx +++ b/src/GraphView.tsx @@ -1,6 +1,7 @@ import { useMemo, useCallback, useEffect, useRef, useState, lazy, Suspense } from 'react' import * as THREE from 'three' import * as d3 from 'd3-force' +import type { ForceGraphMethods } from 'react-force-graph-3d' import { getFolderColor } from './utils' const ForceGraph3D = lazy(() => import('react-force-graph-3d')) @@ -46,15 +47,11 @@ function buildFolderCentroids(folderNames: string[]): Map Record | null - cameraPosition: (pos: { x: number; y: number; z: number }) => void - zoomToFit: (duration: number, padding: number) => void - graphData: () => { nodes: GraphNode[]; links: GraphLink[] } | null - d3Force: (name: string, force?: unknown) => unknown - scene: () => THREE.Scene - nodeThreeObject: unknown +declare module 'react-force-graph-3d' { + // eslint-disable-next-line @typescript-eslint/no-empty-object-type + interface ForceGraphMethods { + graphData(): { nodes: NodeType[]; links: LinkType[] } + } } export default function GraphView({ @@ -65,7 +62,7 @@ export default function GraphView({ bgColor, accentColor, }: GraphViewProps) { - const fgRef = useRef(null) + const fgRef = useRef | undefined>(undefined) const draggedNodesRef = useRef>(new Set()) diff --git a/src/setupTests.ts b/src/setupTests.ts index fc83e00..5a89745 100644 --- a/src/setupTests.ts +++ b/src/setupTests.ts @@ -72,6 +72,7 @@ if (typeof window !== 'undefined') { onPowerResume: vi.fn().mockReturnValue(() => {}), pauseShortcuts: vi.fn(), resumeShortcuts: vi.fn(), + onUpdateReady: vi.fn().mockReturnValue(() => {}), scheduleReminders: vi.fn().mockResolvedValue(undefined), cancelReminders: vi.fn().mockResolvedValue(undefined), scheduleTimer: vi.fn().mockResolvedValue(undefined),