Skip to content

Add undo/redo support and toast notifications for bookmarks - #10

Merged
pheuberger merged 1 commit into
mainfrom
claude/research-undo-implementation-e8Aky
Feb 4, 2026
Merged

Add undo/redo support and toast notifications for bookmarks#10
pheuberger merged 1 commit into
mainfrom
claude/research-undo-implementation-e8Aky

Conversation

@pheuberger

Copy link
Copy Markdown
Owner

Summary

This PR adds undo/redo functionality and toast notifications to the bookmark management system. Users can now undo/redo bookmark operations (create, update, delete, tag changes) using keyboard shortcuts (Cmd+Z / Cmd+Shift+Z) and receive visual feedback through toast notifications.

Key Changes

  • Undo/Redo Support: Integrated Yjs UndoManager to track local bookmark operations with a 500ms capture timeout for grouping rapid changes

    • Exported undo(), redo(), canUndo(), canRedo() functions from useYjs hook
    • Added LOCAL_ORIGIN constant to track which operations are undoable
    • Wrapped all bookmark mutations in transactions with LOCAL_ORIGIN for proper undo tracking
  • Toast Notification System: Created new Toast component and useToast hook

    • Toast.jsx: Individual toast component with auto-dismiss, action buttons, and smooth animations
    • ToastContainer: Manages multiple concurrent toasts
    • useToast(): Hook for managing toast state with add/remove/clear operations
  • Enhanced User Feedback:

    • Delete operations now show toast with "Undo" action button (5s duration)
    • Undo/Redo operations show confirmation toasts (2s duration)
    • Replaced alert() with toast for error messages
    • Updated delete confirmation modal text to indicate undo capability
  • Keyboard Shortcuts:

    • Cmd+Z / Ctrl+Z: Undo
    • Cmd+Shift+Z / Ctrl+Shift+Z: Redo

Implementation Details

  • All bookmark operations (create, update, delete, tag changes, read-later toggle, inbox operations) are now wrapped in Yjs transactions with LOCAL_ORIGIN
  • Toast IDs are managed with a simple incrementing counter
  • Toast animations use CSS transitions for smooth fade-out on dismiss
  • UndoManager is initialized once during Yjs setup and tracks changes to the bookmarks map

https://claude.ai/code/session_01U1TSwicVcAS9dakDkpMoH1

Implement Ctrl+Z/Cmd+Z undo and Ctrl+Shift+Z/Cmd+Shift+Z redo using
Yjs UndoManager. Key changes:

- Add Y.UndoManager to track local bookmark mutations
- Wrap all bookmark CRUD operations in transactions with LOCAL_ORIGIN
- Add Toast component for undo feedback after deletions
- Show "Undo" action in toast when bookmarks are deleted
- Add mod+z and mod+shift+z hotkeys to BookmarkList

Users can now recover deleted bookmarks by pressing Ctrl+Z or clicking
the Undo button in the toast notification.

https://claude.ai/code/session_01U1TSwicVcAS9dakDkpMoH1
@netlify

netlify Bot commented Feb 4, 2026

Copy link
Copy Markdown

Deploy Preview for hypermarkk ready!

Name Link
🔨 Latest commit 40ecc80
🔍 Latest deploy log https://app.netlify.com/projects/hypermarkk/deploys/6983d0c650b70600080e45da
😎 Deploy Preview https://deploy-preview-10--hypermarkk.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@pheuberger
pheuberger merged commit bb77935 into main Feb 4, 2026
5 of 19 checks passed
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