fix(review): adopt latest server_rev on PUT; retry once on 409
Review was POSTing price/sku to /review before each save; that endpoint persists those overrides and bumps server_rev, so the following PUT sent a stale client_rev and hit 409 — Continue to Publish stayed disabled. Stop sending price/sku on review probes (PUT already persists them) and have updateSlab refetch + retry once on revision_conflict.
This commit is contained in:
@@ -379,10 +379,10 @@
|
||||
try {
|
||||
// Run the deterministic review FIRST (reads the current metadata) to get the
|
||||
// title/short_description build before we persist.
|
||||
// Do NOT send price/sku here: review POST persists those overrides and bumps
|
||||
// server_rev (#80), which would stale the client_rev on the PUT below.
|
||||
const probe = await reviewSlab(slabId, {
|
||||
primary_wood_category_id: primaryCatId === '' ? undefined : Number(primaryCatId),
|
||||
price: price === '' ? undefined : Number(price),
|
||||
sku: sku || undefined,
|
||||
});
|
||||
if (myToken !== commitToken) return;
|
||||
// If the owner hasn't typed a title/short-desc, adopt the deterministic build
|
||||
@@ -411,10 +411,10 @@
|
||||
if (myToken !== commitToken) return; // superseded; don't clobber the latest
|
||||
slab = fresh;
|
||||
// Re-run the review against the just-persisted row (authoritative ready/missing).
|
||||
// No price/sku in payload — already on the row from the PUT; sending them
|
||||
// would bump server_rev again and stale the next edit's client_rev.
|
||||
review = await reviewSlab(slabId, {
|
||||
primary_wood_category_id: primaryCatId === '' ? undefined : Number(primaryCatId),
|
||||
price: price === '' ? undefined : Number(price),
|
||||
sku: sku || undefined,
|
||||
});
|
||||
if (myToken !== commitToken) return;
|
||||
if (review.primary_wood_category_id != null) primaryCatId = review.primary_wood_category_id;
|
||||
|
||||
Reference in New Issue
Block a user