Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions AUDIT_LOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 `<ForceGraph3D>` 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)

Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
17 changes: 7 additions & 10 deletions src/GraphView.tsx
Original file line number Diff line number Diff line change
@@ -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'))
Expand Down Expand Up @@ -46,15 +47,11 @@ function buildFolderCentroids(folderNames: string[]): Map<string, { cx: number;
return centroids
}

// Minimal typing for the react-force-graph-3d instance (library ships no declarations)
interface ForceGraphInstance {
controls: () => Record<string, unknown> | 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<NodeType = {}, LinkType = {}> {
graphData(): { nodes: NodeType[]; links: LinkType[] }
}
}

export default function GraphView({
Expand All @@ -65,7 +62,7 @@ export default function GraphView({
bgColor,
accentColor,
}: GraphViewProps) {
const fgRef = useRef<ForceGraphInstance | null>(null)
const fgRef = useRef<ForceGraphMethods<GraphNode, GraphLink> | undefined>(undefined)

const draggedNodesRef = useRef<Set<string>>(new Set())

Expand Down
1 change: 1 addition & 0 deletions src/setupTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
Loading