super-productivity/packages/plugin-dev/sync-md/src/background/sync
Johannes Millan c73eeff75b fix(sync-md): prevent crash from sync oscillation when adding subtask to markdown file
When a user adds a subtask by editing the markdown file directly, the
MD→SP sync creates the task which triggers SP hooks, which trigger
SP→MD sync, which writes the file, which the file watcher detects,
creating a rapid sync oscillation loop that crashes the app.

Three-layer fix:
1. Stop file watcher for the entire MD→SP sync duration and cancel
   pending SP→MD debounce timers
2. Add a cooldown after MD→SP sync (set before and after in finally
   block) to suppress SP hooks that fire as side-effects
3. Simplify lazySetInterval with async/await and a stopped flag to
   prevent zombie rescheduling when cancelled during async callbacks

Also fixes a file watcher race condition where polling could start
before initial mtime was resolved.

Fixes #6021
2026-03-24 14:12:50 +01:00
..
file-watcher.ts fix(sync-md): prevent crash from sync oscillation when adding subtask to markdown file 2026-03-24 14:12:50 +01:00
generate-task-operations.spec.ts test(sync-md): add unit tests for deleted task cleanup functionality 2025-07-12 15:57:55 +02:00
generate-task-operations.ts fix(sync-md): prevent crash when adding subtasks to markdown file directly 2026-01-16 13:28:05 +01:00
header-preservation.integration.spec.ts fix(sync-md): prevent crash when adding subtasks to markdown file directly 2026-01-16 13:28:05 +01:00
markdown-parser.spec.ts feat(sync-md): add support for markdown content before tasks as needed for joplin #4751 2025-07-25 16:01:56 +02:00
markdown-parser.ts feat(sync-md): add support for markdown content before tasks as needed for joplin #4751 2025-07-25 16:01:56 +02:00
md-to-sp.ts fix(sync-md): prevent crash when adding subtasks to markdown file directly 2026-01-16 13:28:05 +01:00
sp-to-md.spec.ts
sp-to-md.ts feat(sync-md): add support for markdown content before tasks as needed for joplin #4751 2025-07-25 16:01:56 +02:00
sync-manager.ts fix(sync-md): prevent crash from sync oscillation when adding subtask to markdown file 2026-03-24 14:12:50 +01:00
types.ts chore(sync-md): add test utilities and error scenario tests 2025-07-11 15:40:48 +02:00
verify-sync.ts feat(sync-md): add support for markdown content before tasks as needed for joplin #4751 2025-07-25 16:01:56 +02:00