Skip to content

Reloading Obsidian while playing can reset PodNotes data to defaults #370

Closed

Description

@chhoumann

Problem. Reloading Obsidian while an episode is playing can reset PodNotes' data.json to defaults. Saved podcasts, play history, the queue, downloads, local files and custom templates are all lost.

Repro (4 of 4 runs, Obsidian 1.13.7). Play an episode, then reload the app (Ctrl+R, "Reload app without saving", or switching mobile emulation). After the reload, PodNotes starts with default settings. Polling data.json every 20 ms showed it at 0 bytes for about 80 ms during the reload. Reloading without playback, reloading the plugin, closing the window and quitting during playback did not lose data.

Deterministic part. Stop Obsidian, truncate data.json to half, start Obsidian. PodNotes replaces the file with defaults within seconds, with no notice and no console error.

Cause (from code). Obsidian's readJson returns undefined when the file cannot be read or parsed. decodePodNotesData treats that like a missing file and decodes {} as an old schema (src/persistence/podNotesData.ts:75), and loadSettings then saves a defaults snapshot right away (src/main.ts:446-461). Which write leaves the file empty during the reload is not yet traced; the periodic playback-position save is the likely candidate.

Expected. PodNotes never overwrites a data.json it could not read. It keeps the file (or a backup), tells the user, and saves are written so a reload mid-write cannot leave an empty file.

Found by the PodNotes runtime QA sweep.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions