Skip to content

Fix looping error when movie/series is deleted from another device#604

Draft
Copilot wants to merge 3 commits intodevelopfrom
copilot/investigate-issue-603
Draft

Fix looping error when movie/series is deleted from another device#604
Copilot wants to merge 3 commits intodevelopfrom
copilot/investigate-issue-603

Conversation

Copy link
Contributor

Copilot AI commented Mar 8, 2026

When a movie/series detail view is open and the item is deleted from another device, onBecomeActive triggers reload() → API returns 404 → error alert shown. On macOS, dismissing the alert re-activates the window (appearsActive toggles), firing onBecomeActive again — infinite loop.

Changes

  • API.Error.isNotFound — new computed property matching badStatusCode(404) and errorResponse(404, _)
  • Movies / SeriesModel .get operation — on 404, remove the item from local items before re-throwing, keeping local cache consistent
  • MovieView / SeriesDetailView / SeasonView reload() — on 404, clear the error and reset the navigation path to root
// before
func reload() async {
    _ = await instance.movies.get(movie)
}

// after
func reload() async {
    guard await instance.movies.get(movie) else {
        if instance.movies.error?.isNotFound == true {
            instance.movies.error = nil
            dependencies.router.moviesPath = .init()
        }
        return
    }
}

Navigation resets to root (not removeLast()) since the detail view may have child views pushed on the stack, and onBecomeActive fires for all views in the macOS window hierarchy simultaneously.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits March 8, 2026 19:10
When a movie/TV show is deleted from another device while its detail view
is open, onBecomeActive triggers reload() which calls the API. The API
returns a 404 error, showing an error alert. On macOS, dismissing the
alert causes the window to become active again (appearsActive changes),
triggering onBecomeActive again, creating an infinite loop.

Fix:
- Add isNotFound property to API.Error to detect 404 status codes
- Remove items from local cache when API returns 404 during get operations
- Navigate back from detail views when reload detects a 404 error

Co-authored-by: tillkruss <665029+tillkruss@users.noreply.github.com>
Co-authored-by: tillkruss <665029+tillkruss@users.noreply.github.com>
Copilot AI changed the title [WIP] Investigate potential causes for issue #603 Fix looping error when movie/series is deleted from another device Mar 8, 2026
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