Skip to content

Conversation

@devin-ai-integration
Copy link
Contributor

@devin-ai-integration devin-ai-integration bot commented Jan 22, 2026

Summary

Adds undo functionality for note deletion. When a user deletes a note, they can press Cmd+Z (Mac) / Ctrl+Z (Windows/Linux) or click the "Undo" button in a toast notification to restore it within 5 seconds.

How it works:

  • Before deletion, a TinyBase checkpoint captures the current state
  • Session data is deleted immediately from TinyBase (for responsive UI)
  • Audio file deletion is delayed by 5 seconds to allow undo
  • On undo, the checkpoint is restored and the audio deletion is cancelled
  • Session persister cleanup is deferred for pending deletes to prevent race conditions

Files changed:

  • store/zustand/undo-delete.ts - New Zustand store tracking pending deletions + getPendingDeleteSessionIds() helper
  • hooks/useUndoDelete.ts - Hook that registers the mod+z hotkey
  • components/undo-delete-toast/index.tsx - Toast UI with undo button
  • store/tinybase/store/deleteSession.ts - Extracted deleteSessionData helper
  • store/tinybase/persister/session/persister.ts - Modified cleanup to respect pending deletes
  • delete.tsx - Updated to use checkpoint-based deletion

Updates since last revision

  • Fixed race condition between undo and persister cleanup: sessions awaiting undo are added to keepIds to prevent premature directory deletion
  • Fixed toast not appearing: added key prop to AnimatePresence child (required for motion/react to properly track mount/unmount lifecycle)
  • Added checkpoints.clear() after undo to clean up checkpoint history

Review & Testing Checklist for Human

  • Verify toast appears: Delete a note → confirm toast notification shows at bottom of screen with note title
  • Test full undo flow: Delete a note → click Undo or press Cmd+Z → verify note is restored with all data (transcripts, participants, tags)
  • Test keyboard shortcut isolation: While editing note content, press Cmd+Z → verify it undoes text changes, not the last deletion
  • Test audio preservation: Delete a note with a recording → undo within 5 seconds → verify audio file is still playable
  • Test timeout behavior: Delete a note → wait >5 seconds → verify undo is no longer available and audio is deleted

Recommended test plan:

  1. Create a note with content and a recording
  2. Delete it via the overflow menu
  3. Verify toast shows with note title
  4. Press Cmd+Z to undo
  5. Verify note reappears with content and audio intact
  6. Delete again and wait 6 seconds
  7. Verify toast disappears and undo no longer works

Notes

Known limitation: If undo is triggered after 5 seconds, the session data cannot be restored (toast is already gone). The audio file is permanently deleted at the 5-second mark.

Not tested locally: Due to Rust toolchain environment issues, local app testing was not possible. TypeScript typecheck passes and CI should verify the build.

Requested by @ComputelessComputer

Link to Devin run: https://app.devin.ai/sessions/364a0344939c4210be93395293bb208e

Co-Authored-By: john@hyprnote.com <john@hyprnote.com>
@devin-ai-integration
Copy link
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR that start with 'DevinAI' or '@devin'.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@netlify
Copy link

netlify bot commented Jan 22, 2026

Deploy Preview for hyprnote-storybook canceled.

Name Link
🔨 Latest commit 70c51b9
🔍 Latest deploy log https://app.netlify.com/projects/hyprnote-storybook/deploys/69735ed613844a0008befd01

@netlify
Copy link

netlify bot commented Jan 22, 2026

Deploy Preview for hyprnote canceled.

Name Link
🔨 Latest commit 70c51b9
🔍 Latest deploy log https://app.netlify.com/projects/hyprnote/deploys/69735ed6f82f2100083d0286

@netlify
Copy link

netlify bot commented Jan 22, 2026

Deploy Preview for howto-fix-macos-audio-selection canceled.

Name Link
🔨 Latest commit 70c51b9
🔍 Latest deploy log https://app.netlify.com/projects/howto-fix-macos-audio-selection/deploys/69735ed6d72f2a0008e4ce15

devin-ai-integration bot and others added 4 commits January 23, 2026 02:32
Co-Authored-By: john@hyprnote.com <john@hyprnote.com>
Co-Authored-By: john@hyprnote.com <john@hyprnote.com>
Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>
Co-Authored-By: john@hyprnote.com <john@hyprnote.com>
Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants