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
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,14 @@
"use-debounce": "^10.1.1"
},
"devDependencies": {
"@babel/core": "^7.29.7",
"@biomejs/biome": "latest",
"@playwright/test": "^1.63.0",
"@rolldown/plugin-babel": "^0.2.4",
"@tailwindcss/postcss": "^4.3.3",
"@tailwindcss/typography": "^0.5.20",
"@tailwindcss/vite": "^4.3.3",
"@types/babel__core": "^7.20.5",
"@types/node": "^24.13.3",
"@types/react": "^19.3.0",
"@types/react-dom": "^19.3.0",
Expand Down
86 changes: 78 additions & 8 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 1 addition & 8 deletions src/features/history/history-modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,7 @@ export const HistoryModal = ({ isOpen, onClose, initialTabIndex = 0 }: HistoryMo
handleDeleteAllSnapshots,
handleDeleteTask,
handleDeleteAllTasks,
refresh,
} = useHistoryData();

useEffect(() => {
if (isOpen) {
refresh();
}
}, [isOpen, refresh]);
} = useHistoryData(isOpen);

useEffect(() => {
if (isOpen && snapshots.length > 0 && !selectedSnapshot) {
Expand Down
12 changes: 9 additions & 3 deletions src/features/history/use-history-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ type HistoryData = {
handleDeleteAllSnapshots: () => void;
handleDeleteTask: (id: string) => void;
handleDeleteAllTasks: () => void;
refresh: () => void;
};

// Cache for date strings to avoid recreating them repeatedly
Expand Down Expand Up @@ -101,7 +100,7 @@ const groupItemsByDate = <T extends { timestamp?: string; completedAt?: string }
return result;
};

export const useHistoryData = (): HistoryData => {
export const useHistoryData = (isOpen: boolean): HistoryData => {
const [snapshots, setSnapshots] = useState<Snapshot[]>([]);
const [tasks, setTasks] = useState<CompletedTask[]>([]);
const [isLoading, setIsLoading] = useState(true);
Expand Down Expand Up @@ -174,6 +173,14 @@ export const useHistoryData = (): HistoryData => {
};
}, []);

// The modal stays mounted while closed, so reload whenever it opens.
// Keyed on isOpen only: loadData is recreated each render, and depending on it loops forever.
useEffect(() => {
if (isOpen) {
loadData();
}
}, [isOpen]);

// Handle restore snapshot
const handleRestoreSnapshot = (snapshot: Snapshot) => {
try {
Expand Down Expand Up @@ -252,6 +259,5 @@ export const useHistoryData = (): HistoryData => {
handleDeleteAllSnapshots,
handleDeleteTask,
handleDeleteAllTasks,
refresh: loadData,
};
};
12 changes: 4 additions & 8 deletions vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,16 @@
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import react, { reactCompilerPreset } from "@vitejs/plugin-react";
import babel from "@rolldown/plugin-babel";
import wasm from "vite-plugin-wasm";
import tailwindcss from "@tailwindcss/vite";
import { visualizer } from "rollup-plugin-visualizer";
import { VitePWA } from "vite-plugin-pwa";

const ReactCompilerConfig = {};

// https://vitejs.dev/config/
export default defineConfig({
plugins: [
react({
babel: {
plugins: [["babel-plugin-react-compiler", ReactCompilerConfig]],
},
}),
react(),
babel({ presets: [reactCompilerPreset()] }),
wasm(),
tailwindcss(),
VitePWA({
Expand Down
Loading