Skip to content

Show permission errors immediately when navigating to restricted folders #189

@BrianLeishman

Description

@BrianLeishman

Summary

When navigating to a folder that requires permissions (like macOS Trash), the app shows a spinner indefinitely. The error only appears after manually refreshing. The error should display immediately, and clicking "OK" should navigate back to the previous location or home folder.

Current State

  • File: src/store/useAppStore.ts:507-609 (navigateTo function)
  • File: src/store/useAppStore.ts:711-780 (refreshCurrentDirectory function)
  • Navigation calls refreshCurrentDirectory which catches errors and sets error state
  • However, errors from permission issues don't trigger immediate UI feedback - just an endless spinner
  • After reload, error dialog shows: "Failed to refresh: Failed to read directory: Operation not permitted (os error 1)"
  • Clicking "OK" leaves user on the broken path with no way to navigate away easily

Proposed Changes

  1. Immediate error feedback: When navigateTo fails due to permission errors, show the error dialog immediately instead of leaving the spinner running
  2. Navigate away on dismiss: When user clicks "OK" on the permission error dialog:
    • Navigate back to the previous history location if available (goBack())
    • Or navigate to home folder if no history exists
  3. Better error messaging: Include actionable guidance in the error message (e.g., "Grant access under System Settings → Privacy & Security → Files and Folders")

Technical Notes

  • The navigateTo function at line 507 updates path history before directory contents are loaded
  • The refreshCurrentDirectory function catches errors at line 758 but only sets error state
  • Need to either: roll back history on failure, or not commit to history until directory loads successfully
  • Consider using message() dialog (from Tauri) for permission errors instead of just setting error state

Acceptance Criteria

  • Permission errors show immediately when navigating (no endless spinner)
  • Error dialog displays with clear guidance on how to fix permissions
  • Clicking "OK" navigates user back to previous location or home
  • Path bar doesn't show the failed path after dismissing error

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions