Skip to content

[Bug]: Recorded Podcast Wiped Out and Deleted when Navigating Back from Preview Player #1838

Description

In
PodcastRecorder.tsx
, a useFocusEffect hook is defined that triggers handleUpload() every time the screen comes into focus.

However, handleUpload() resets the entire recording state (setting filePath to null and uiState to idle) and deletes the recording from local storage (await unlinkFile()).

The issue: When a user records a podcast and navigates to the PodcastPlayer screen to preview it, navigating back to PodcastRecorder causes the screen to refocus. This fires the useFocusEffect, which instantly triggers handleUpload(), wiping the recorded podcast and deleting the local file. The user is forced to record the podcast again.

Lines causing the bug:

typescript

useFocusEffect(
useCallback(() => {
handleUpload(); // Fires on every screen focus, destroying existing recording data
}, []),
);
Expected behavior:

The useFocusEffect should not unconditionally clear recording data on focus.
Wiping/resetting the recording data should only happen when explicitly requested (e.g., when clicking "Retry" or after a successful upload), or only on screen unmount/mount.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions