Skip to content

Close focused media when its backing file disappears #13

Description

@dremnik

Summary

Focused media resolves its item only when the view mounts. If Finder or another process removes or renames the backing file afterward, no filesystem listener remains active in media mode and the view does not return to the canvas as intended.

Evidence

  • src/media/MediaView.tsx:51-62 calls openDirectory only during the mount effect.
  • MediaView does not subscribe to fs-event.
  • Opening media unmounts CanvasView, which owns the existing filesystem-event subscription.
  • The source comment and recent implementation commit state that media should close when its item disappears.

Proposed change

  1. Keep workspace filesystem reconciliation active independently of the current visual mode.
  2. Resolve relevant events through durable item identity rather than only the original path.
  3. Close to the canvas when the item is deleted or becomes a tombstone.
  4. Update the media source and metadata when an external rename preserves the item identity.
  5. Surface permission and decode failures explicitly rather than leaving an empty media stage.

Acceptance criteria

  • Deleting the open file externally closes focused media and shows its tombstone on the canvas.
  • Renaming the open file externally preserves the focused view and updates its filename when identity reconciliation succeeds.
  • Permission loss produces a labeled error and a safe route back to the canvas.
  • Event listeners are cleaned up without duplicate subscriptions.
  • Tests cover delete, rename, permission loss, and unrelated filesystem events.

Metadata

Metadata

Assignees

No one assigned

    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