Skip to content

feat: notify other users when a version is restored#369

Open
leotrs wants to merge 5 commits intomainfrom
std-7oh1
Open

feat: notify other users when a version is restored#369
leotrs wants to merge 5 commits intomainfrom
std-7oh1

Conversation

@leotrs
Copy link
Copy Markdown
Collaborator

@leotrs leotrs commented Apr 3, 2026

Summary

  • Added useRestoreNotification composable that watches Y.js awareness states for other users' restoring field
  • When another connected user starts a version restore (null → versionId transition), shows an info toast: "{name} restored a previous version — Your editor has been updated"
  • Wired into Canvas.vue where the shared awareness ref is provided
  • Filters out self (no toast for own restores), handles missing user info gracefully, auto-cleans up on unmount

Test plan

  • 6 unit tests for useRestoreNotification (all pass)
  • Existing 28 Canvas.vue tests still pass
  • Existing 12 useVersionRestore tests still pass
  • Manual: open same file in two browser tabs, restore a version in one — other tab should show toast

🤖 Generated with Claude Code

Add useRestoreNotification composable that watches Y.js awareness states
for other users' 'restoring' field transitions. When another user starts
a restore, shows an info toast: "{name} restored a previous version".
Wired into Canvas.vue where awareness is provided.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@netlify
Copy link
Copy Markdown

netlify bot commented Apr 3, 2026

Deploy Preview for rsm-studio-frontend canceled.

Name Link
🔨 Latest commit 9837445
🔍 Latest deploy log https://app.netlify.com/projects/rsm-studio-frontend/deploys/69d28235adab8d0008c5b8a2

@netlify
Copy link
Copy Markdown

netlify bot commented Apr 3, 2026

Deploy Preview for rsm-studio-site canceled.

Name Link
🔨 Latest commit 9837445
🔍 Latest deploy log https://app.netlify.com/projects/rsm-studio-site/deploys/69d282353d1be6000845f7de

@leotrs
Copy link
Copy Markdown
Collaborator Author

leotrs commented Apr 3, 2026

Needs human review

What changed: Added a toast notification that appears when another connected user restores a previous version of a document ("Alice restored a previous version — Your editor has been updated").

Review checklist:

  1. Open the deploy preview: https://deploy-preview-369--rsm-studio-frontend.netlify.app
  2. Log in with two different accounts (or two browser tabs with different sessions)
  3. Open the same document in both tabs
  4. In one tab, restore a previous version
  5. Verify the other tab shows an info toast: "{name} restored a previous version" with description "Your editor has been updated"
  6. Verify the tab that performed the restore does NOT show a toast to itself
  7. Verify the toast auto-dismisses after ~5 seconds

What to look for:

  • Toast appears promptly after the restore action
  • Toast does not appear for the user who initiated the restore (self-filtering)
  • No duplicate toasts if the restore action is repeated
  • Toast text is correct and readable (no "undefined" or "Someone" when user info is available)
  • No console errors in the browser during the flow
  • Edge case: disconnect one tab's network briefly, reconnect, and restore — verify no spurious toasts

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 4, 2026

Preview Deploy

Frontend: https://pr-369--rsm-studio-frontend.netlify.app
Backend: https://aris-backend-staging.fly.dev (staging)
API docs: https://aris-backend-staging.fly.dev/docs

Test user: preview-pr-369@aris.pub

This preview will be destroyed when the PR is closed.

@leotrs
Copy link
Copy Markdown
Collaborator Author

leotrs commented Apr 4, 2026

Needs human review

What changed: When another connected user restores a previous version, a toast notification now appears: "{name} restored a previous version — Your editor has been updated."

Review checklist:

  1. Open a document in two separate browser tabs (logged in as different users, or same user in two tabs)
  2. In Tab A, open the version history and restore a previous version
  3. In Tab B, verify an info toast appears with the restoring user's name and the message "Your editor has been updated"
  4. Verify the toast auto-dismisses after ~5 seconds
  5. Verify that Tab A (the user who performed the restore) does NOT see a toast for their own action
  6. Test with a user who has no display name — toast should show "Someone restored a previous version"

What to look for:

  • Toast appears promptly after the restore action (not delayed or duplicated)
  • Toast styling matches existing info toasts in the app
  • No duplicate toasts if the same user restores multiple times in quick succession
  • No toast appears on initial page load when another user already has a restoring state
  • Editor content actually updates to match the restored version (existing behavior, but verify it still works)

@leotrs
Copy link
Copy Markdown
Collaborator Author

leotrs commented Apr 5, 2026

Needs human review

What changed: New toast notification appears to collaborators when another user restores a previous version of a document.

Review checklist:

  1. Open the same file in two separate browser tabs (logged in as different users, or two windows with distinct sessions)
  2. In Tab A, open the version history and restore a previous version
  3. In Tab B, verify an info toast appears: "{name} restored a previous version — Your editor has been updated"
  4. Verify Tab A does NOT show the toast to itself
  5. Verify the toast auto-dismisses after ~5 seconds
  6. Test with a user that has no display name — toast should say "Someone restored a previous version"

What to look for:

  • Toast appears promptly after the restore action (no noticeable delay)
  • Toast text is correct and includes the restoring user's name
  • No duplicate toasts (restoring the same version twice should show two toasts, but clearing the restoring state should not trigger one)
  • No toast on initial page load when another user already has a restoring state set
  • No console errors related to awareness state changes

🤖 Generated with Claude Code

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.

1 participant