Automattic / Automattic/cortext

Serialize saves to the same field

Open
#300 0 comments 0 reactions 0 assignees View on GitHub
area: collections priority: low type: bug
Dominant language
JavaScript
Stars
51
Forks
2
Avg merge
3h 12m
Merged PRs (30d)
8

Description

Editing the same field twice quickly can fire two apiFetch calls that land out of order, so the older value wins. The version map keeps the displayed value correct but doesn't control write order. You'd need fast select or relation toggles to overlap (typing is covered by the debounce), so it's unlikely and low priority.

**Proposed solution:** chain each field's save on the previous one's in-flight promise so they go out in order. Moving documents to core-data (#298) would also settle it, since saves for one record run through a single `saveEntityRecord` queue.

Contributor guide

Open the contributing guide

Research direction

Start by tracing the field save path that issues the apiFetch calls and uses the version map. Reproduce overlapping fast-select or relation-toggle saves, then verify that each field's writes resolve in dispatch order and the older value cannot overwrite the newer one.

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
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.