You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fixed on page 43 (Workshops & Programs) — the list now shows a single row. Here's what was happening.
The pages table was always fine: one document, id 43. But the admin list for a drafts-enabled collection doesn't read pages — it reads the versions table _pages_v filtered on latest = true, and maps each row to { id: parent, ...version }. Page 43 had several rows flagged latest, so it painted once per row, every one of them linking to /pages/43. That's also why the pagination counter disagreed with the number of rows on screen.
The cause is upstream. createVersion in @payloadcms/drizzle inserts the new version row, then clears the previous latest flags in a separate, non-transactional statement guarded by a strict comparison:
UPDATE _pages_v SET latest = false
WHERE id !=<new>AND parent =<parent>AND updated_at <<new updated_at>
Any existing row whose updated_atequals the incoming one is skipped and keeps latest = true. Two version writes landing on the same millisecond both survive. Our three stale draft rows all carried the identical timestamp 16:45:35.574.
The fix, if this shows up again: open the affected doc and save a draft. The new version's updated_at is strictly greater than every stale row, so the demote clears all of them at once. No database surgery needed.
Blast radius: I checked every page across all four tenants — 210 documents, and page 43 was the only one affected. Posts are clean. Rare, not systematic.
One thing I have not confirmed: whether this explains what Zoe was hitting when replacing the images. The stale latest rows would make it ambiguous which version the editor and preview were resolving to, which is a plausible path to "my edits don't show up" — but that's a hypothesis, not something I verified. @rustynwac, can you and Zoe retry the image swap now that the duplicates are gone and let me know? If it still misbehaves, that's a separate bug and worth its own issue.
Correcting my last comment — I told you and Zoe to retry the image swap, and that won't work on its own. Sorry. I've since dug into her screenshots and the images problem is a separate bug from the duplicate rows, with its own cause. Filed as #1249 — Media deletes are unguarded — dangling references block publish with an unexplained validation error.
What's actually wrong: media 826 was deleted, but page 43 still references it in two blocks — the Northwest Snow and Avalanche Workshop block and the Going Deep block. That's why those two sections render as blank space, and it's what This field has the following invalid selections: 826, is complaining about.
Two things made this so confusing:
It's referenced twice. Replace the image in one block, save, and you get the identical error again — because the other block is still pointing at the deleted file, and nothing on screen tells you it's there.
Draft saves work, Publish doesn't. Payload skips validation on draft saves, so a draft goes through fine and only Publish trips the error. From the editor's side that reads as "it saved but the site never changed."
@rustynwac — what Zoe needs to do: replace the image in both the NSAW block and the Going Deep block, then Publish. Fixing only one won't clear it. If Publish still errors after both, the id in the message will have changed and there's a third reference somewhere — send me the new number and I'll trace it.
The duplicate-rows problem is separate and already resolved; page 43 shows a single row now.
Activity
busbyk commentedon Sep 1, 2026
Fixed on page 43 (Workshops & Programs) — the list now shows a single row. Here's what was happening.
The
pagestable was always fine: one document, id 43. But the admin list for a drafts-enabled collection doesn't readpages— it reads the versions table_pages_vfiltered onlatest = true, and maps each row to{ id: parent, ...version }. Page 43 had several rows flaggedlatest, so it painted once per row, every one of them linking to/pages/43. That's also why the pagination counter disagreed with the number of rows on screen.The cause is upstream.
createVersionin@payloadcms/drizzleinserts the new version row, then clears the previouslatestflags in a separate, non-transactional statement guarded by a strict comparison:Any existing row whose
updated_atequals the incoming one is skipped and keepslatest = true. Two version writes landing on the same millisecond both survive. Our three stale draft rows all carried the identical timestamp16:45:35.574.Upstream issue: payloadcms/payload#17216 — Duplicate latest=1 version rows under autosave on D1/SQLite — createVersion clears prior latest flags non-transactionally with a strict updated_at< guard. Open, unlabelled, no linked PR. Reported against D1 with autosave on; we hit it on Turso with autosave off, so the guard is the bug, not the adapter.
The fix, if this shows up again: open the affected doc and save a draft. The new version's
updated_atis strictly greater than every stale row, so the demote clears all of them at once. No database surgery needed.Blast radius: I checked every page across all four tenants — 210 documents, and page 43 was the only one affected. Posts are clean. Rare, not systematic.
One thing I have not confirmed: whether this explains what Zoe was hitting when replacing the images. The stale
latestrows would make it ambiguous which version the editor and preview were resolving to, which is a plausible path to "my edits don't show up" — but that's a hypothesis, not something I verified. @rustynwac, can you and Zoe retry the image swap now that the duplicates are gone and let me know? If it still misbehaves, that's a separate bug and worth its own issue.busbyk commentedon Sep 1, 2026
Correcting my last comment — I told you and Zoe to retry the image swap, and that won't work on its own. Sorry. I've since dug into her screenshots and the images problem is a separate bug from the duplicate rows, with its own cause. Filed as #1249 — Media deletes are unguarded — dangling references block publish with an unexplained validation error.
What's actually wrong: media
826was deleted, but page 43 still references it in two blocks — the Northwest Snow and Avalanche Workshop block and the Going Deep block. That's why those two sections render as blank space, and it's whatThis field has the following invalid selections: 826,is complaining about.Two things made this so confusing:
@rustynwac — what Zoe needs to do: replace the image in both the NSAW block and the Going Deep block, then Publish. Fixing only one won't clear it. If Publish still errors after both, the id in the message will have changed and there's a third reference somewhere — send me the new number and I'll trace it.
The duplicate-rows problem is separate and already resolved; page 43 shows a single row now.