Skip to content

Add user notification for background child transfer failures #656

Description

@malibio

Summary

When createNode() transfers children to the database in the background, failures are logged to console but users are not notified. This can lead to silent data inconsistencies that confuse users.

Current Behavior

In reactive-node-service.svelte.ts, the background child transfer has proper rollback logic but no user notification:

Promise.resolve().then(async () => {
  try {
    await sharedNodeStore.waitForNodeSaves([nodeId]);
    for (const child of children) {
      const { moveNode } = await import('$lib/services/tauri-commands');
      await moveNode(child.id, nodeId);
    }
  } catch (error) {
    console.error('[createNode] Failed to transfer children to database, rolling back:', error);
    for (const child of children) {
      structureTree.moveInMemoryRelationship(nodeId, afterNodeId, child.id);
    }
    // TODO: Emit error event for UI notification (toast/banner)
  }
});

Expected Behavior

When child transfer fails:

  1. Rollback happens (already implemented)
  2. User sees a toast/banner notification explaining the issue
  3. User can retry or take corrective action

Acceptance Criteria

  • Create an event/notification system for async operation failures
  • Show toast notification when child transfer rollback occurs
  • Message should be user-friendly (e.g., "Changes couldn't be saved. Please try again.")
  • Consider adding a retry action to the notification

Technical Notes

Labels

enhancement, ux, error-handling

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions