You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Import: closing the recorder mid-save can leave a clip or an empty draft behind #272
Raised in review on #240 (src/features/recorder/use-recorder.ts, the library import).
What happens
After the import's conversion finishes, the recorder still runs four steps with no cancel check between them: it creates the draft if needed (ensureDraft), copies the file into the draft, reads its length, and saves the clip (persistSegment). If the recorder is closed during those steps:
the clip can still be added to a draft the person already left, or a new draft can be created after the screen is gone;
the recorder's close-time cleanup, which deletes a draft that looks empty, can delete the draft this import is still writing to.
It's rare: those steps take a fraction of a second after a conversion that can take much longer. From reading the code; not reproduced.
Fix
Check the import's abort signal after each of those steps, and before saving the clip.
On a cancel, delete the copied file, and delete the draft if this import created it.
Make the close-time cleanup wait for an import in flight (or skip a draft an import is writing to), so it can't delete a draft that is being saved.
Done when
Closing the recorder at any point of an import leaves either the clip saved in its draft or nothing at all: no stray file, no empty draft, no clip added after the screen is gone.
Activity
fix(import): closing the recorder mid-save leaves the clip whole or n…