Repository navigation
fix(recordings): Stop deleting the last recording from returning a 404 - #555
Merged
Merged
Conversation
The bulk and single delete routes treated an empty recordings list as a failure, so deleting the last remaining recordings returned a 404 and the frontend kept showing the deleted files. - Return the remaining list from the delete routes, even when it is empty - Remove deleted recordings from the cached list in bulk delete - Clear cached durations by full path, which is the key they are stored by - Show an error toast in the frontend when the delete request fails Fixes #554 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The 404 handler that serves index.html for frontend routes also caught 404s raised by API routes. It returned index.html with a 200 status, so the frontend tried to parse the HTML as JSON and showed an error toast. On the device, this made deleting the last recording show "Failed to delete recording" even though the files were deleted. Paths under /api/ now use FastAPI's default handler and return the JSON error. Refs #554 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
brandonhs
commented
Oct 1, 2026
| return; | ||
| } | ||
|
|
||
| recordingsState.recordings = result.data; |
Member
Author
There was a problem hiding this comment.
Forgot this still used valtio...
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
On the device, deleting the last recording(s) showed a "Failed to delete recording" toast even though the files were deleted. Two bugs caused this:
if not response, so when no recordings were left ([]) they returned a 404 after the files were already deleted.run_release.py, which servesindex.htmlfor frontend routes, also caught API 404s and returnedindex.htmlwith a 200 status. openapi-fetch then tried to parse the HTML as JSON, threw, andperformDeleteshowed the error toast.Changes
run_release.py: the 404 handler now uses FastAPI's default JSON response for paths under/api/. Other paths still getindex.html. This also fixes the same problem for any other API 404 on the release build.POST /api/recordings/bulk-deletealways returns the remaining recordings, including an empty list.DELETE /api/recordings/{recording_path}returns a 404 only when the file does not exist (response is None).bulk_delete_recordingsnow removes deleted files from the cachedself.recordings, likedelete_recordingalready did.delete_recordingnow takesrecordings_lock. Both delete methods use a shared_remove_recording_filehelper.performDeletenow shows an error toast when the request returns an error status. Before, an error status showed no toast.Fixes #554
Testing
I ran an app with the recordings router, a
StaticFilesmount, and the same 404 handler asrun_release.py:mainindex.html[]index.htmldetailGET /recordings(frontend route)index.htmlindex.htmlruff,ty,tscandeslintpass. I have not tested this on a device.Type of change
Quick Checklist
🤖 Generated with Claude Code