Automattic / Automattic/cortext
Don't lose a field edit when the tab closes
- Dominant language
- JavaScript
- Stars
- 51
- Forks
- 2
- Avg merge
- 3h 12m
- Merged PRs (30d)
- 8
Description
If you edit a document property and close the tab within the 500ms save debounce, the edit can be lost. The field-save queue does flush on `beforeunload`, but it's an async apiFetch with no keepalive and no "leave site?" prompt, so the browser can cancel it mid-flight. Title and content don't have this problem; they go through the editor autosave that #294 already flushes and prompts on. Field edits left that path when they moved to apiFetch.
**Proposed solution:** shorten or drop the debounce, or mark the post dirty while a field save is in flight so #294's prompt picks it up. It goes away on its own once documents move to core-data (#298), so only worth doing if that's far off.
Contributor guide
Research direction
Start by tracing the field-save queue, its 500ms debounce, and the beforeunload apiFetch path, then compare it with the editor autosave behavior described in #294. Done means a field edit is not lost when the tab closes during saving, while title and content retain their existing flush and prompt behavior; check whether the planned move to core-data in #298 changes the scope.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100