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
4 changes: 2 additions & 2 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ Maple is a **Tauri-based AI chat application** that runs on desktop (macOS, Linu
### Frontend
- `src/app.tsx` - App entry, sets up all providers (OpenSecret, QueryClient, etc.)
- `src/components/UnifiedChat.tsx` - **Main chat interface** (the logged-in experience)
- `src/state/LocalStateContext.tsx` - Global state (chats, models, billing status)
- `src/state/LocalStateContext.tsx` - Global UI, model, and billing state
- `src/ai/OpenAIContext.tsx` - OpenAI API integration
- `src/utils/platform.ts` - Platform detection (iOS/Android/macOS/desktop/web)
- `src/billing/billingApi.ts` - Subscription and billing logic
- `src/routes/` - TanStack Router file-based routing (`_auth.*` routes require login)
- `src/routes/` - TanStack Router file-based routing

### Rust (src-tauri)
- `src/lib.rs` - Tauri entry point, plugin setup, command handlers
Expand Down
19 changes: 5 additions & 14 deletions frontend/src/components/AccountMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,24 +56,12 @@ import packageJson from "../../package.json";
import { SIDEBAR_ACCOUNT_MENU_WIDTH_CLASS, SIDEBAR_LAYOUT_STYLE } from "@/constants/layout";

function ConfirmDeleteDialog() {
const { clearHistory } = useLocalState();
const os = useOpenSecret();
const queryClient = useQueryClient();
const navigate = useNavigate();

async function handleDeleteHistory() {
// 1. Delete archived chats (KV)
try {
await clearHistory();
console.log("History (KV) cleared");
} catch (error) {
console.error("Error clearing history:", error);
// Continue to delete server conversations even if this fails
}

// 2. Delete server conversations (API) if any exist
try {
// Check if we have any conversations to delete
const conversations = await os.listConversations({ limit: 1 });
if (conversations.data && conversations.data.length > 0) {
await os.deleteConversations();
Expand All @@ -84,10 +72,13 @@ function ConfirmDeleteDialog() {
}

// Always refresh UI and navigate home
queryClient.invalidateQueries({ queryKey: ["chatHistory"] });
queryClient.invalidateQueries({ queryKey: ["conversations"] });
Comment thread
devin-ai-integration[bot] marked this conversation as resolved.
queryClient.invalidateQueries({ queryKey: ["archivedChats"] });
queryClient.invalidateQueries({ queryKey: ["pinnedConversations"] });
queryClient.invalidateQueries({ queryKey: ["projectConversations"] });
queryClient.invalidateQueries({ queryKey: ["conversationProjects"] });
queryClient.invalidateQueries({ queryKey: ["conversationProject"] });
navigate({ to: "/" });
Comment on lines 72 to 80

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚩 Orphaned KV data not cleaned up when deleting all history

The old handleDeleteHistory in AccountMenu.tsx:63 called clearHistory() which invoked delAll() on the KV store, removing old history_list and chat_* keys. The new code only calls os.deleteConversations() to delete server-side conversations. Users who had archived chats in KV storage will retain that orphaned data indefinitely. While this data is no longer visible in the UI (since the archived chat section and _auth.chat.$chatId route are removed), it still occupies storage. This may matter for users who expect "Delete entire chat history" to remove all their data for privacy reasons. Consider whether a one-time KV cleanup migration or a final delAll() call should be added.

(Refers to lines 63-80)

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Intentionally not adding a final delAll() here because the requested scope is to remove all KV-related chat code. Reintroducing delAll() in handleDeleteHistory would keep the KV dependency alive in the client. If we need historical KV data erasure for privacy/storage cleanup, that should be handled as a separate one-time backend/admin cleanup or migration rather than retaining client-side KV access in Maple.

window.dispatchEvent(new CustomEvent("newchat", { detail: { projectId: null } }));
}

return (
Expand Down
Loading
Loading