Repository navigation
feat(content): filter the Library by each page's last send to the CMS - #1567
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Preview approval requiredThis pull request comes from a fork, so Mintlify won't build a preview until someone with write access approves commit |
7 of 12 tasks
gkhngyk
approved these changes
Oct 27, 2026
gkhngyk
left a comment
Contributor
There was a problem hiding this comment.
Looks good, with follow-ups.
What I checked:
- Where it filters. In the browser, over the list the Library already holds. There's no paging to get wrong:
getContentDraftsreturns the brand's latest 500 drafts byupdated_at(LIBRARY_LIMIT), and the table renders all of them.readCmsStatusesalready reads their last sends for the row marks. That's onecontent_draft_last_deliveriescall, since it takes 500 ids and the list is capped at 500. It usescontent_draft_deliveries_draft_created.- The PR adds no request.
draftsLastSent,sendsReadandanySentare one pass each over at most 500 rows. - The tab counts aren't narrowed, as with Created. Export (
page.tsx:367) and the bulk bar (:338) both takelisted, so they act on the filtered rows. - The cap is covered in follow-up 2.
- The states match the mark. The filter reads the same
cmsmap and the samestatusasCmsStatusMark:- Never sent: no delivery, so no mark.
- Sending:
queued, under 30 minutes. - Sent, Failed and Published: the mark's own status. A send queued for more than 30 minutes reads as failed, through
lastSendincms-send-client.ts, as the mark does. - Targets. The filter ignores the target. A Webflow draft item is Sent, and its mark says so. Once Webflow reports it live, it's Published. WordPress and Framer (#1572, #1580) fit the same states.
- "Published". Here it's the delivery's status, meaning the CMS reported the page live. That also sets the draft to Published when it's the latest send (
content-published.js:37-47). A page marked published by hand (CE-013,markDraftPublished) keeps its delivery as it was. So it's under the Published tab but listed here as Sent or Never sent, beside a Published badge. That matches the mark. See follow-up 4 for the docs.
- The wait.
- While the sends of the listed drafts are unread, the list shows the loading dots, Export is disabled and nothing can be picked. That's
sendsRead, and the read drafts are compared as a set. - A read that only changes the order doesn't wait again.
- On a brand switch, the old brand's ids don't count, and
anySentonly looks at this brand's drafts.
- While the sends of the listed drafts are unread, the list shows the loading dots, Export is disabled and nothing can be picked. That's
- URL.
readUrlChoice('sent', SEND_FILTERS, 'all'): an unknown value reads as Any, with no crash. Choosing Any removes the param. - When it shows. The select shows once one of the listed drafts has a send, or while the URL names a filter. On a brand with no sends, choosing Any from a URL-opened filter hides the select again. That's as the PR describes.
- Empty state. When the date range already leaves nothing, it blames Created. Otherwise it shows the Last send message. The cap's note is hidden while the filter is on.
- The deploy gap. None. Web only, with no API call.
content_draft_last_deliveriesis from 00262, is on prod, and the marks read it already. - Speed. No regex. No loop beyond one pass over the list.
- Tests. I ran both files from an export of the head, outside the repo.
- On the head: 60 pass. The long-list Export test times out at the default 5 s on this machine, on the base too. The test after it then fails because of that timeout, and passes when run alone. With a 60 s timeout, all 60 pass.
- With
page.tsxback at the base: 8 of the 11 new page tests fail. Three pass anyway: the order re-read, no select without sends, and the Created empty state. They guard parts of the change that the base can't break. drafts.test.tsfails withoutdraftsLastSent.
- Merge.
- One commit on 3b650fb. Main's 55b49e7 doesn't touch the Library.
git merge-treeis clean (968c0c2b), with the same change as the PR's own diff, and the 60 tests pass on that tree. - It merges cleanly with each open PR on the same files: #1507, #1572, #1573, #1578, #1580 and #1581. On #1567 + #1580, the two test files pass (66 tests).
- One commit on 3b650fb. Main's 55b49e7 doesn't touch the Library.
Follow-ups:
- A failed read of the sends reads as "Never sent" (
cms-send-client.ts:204-207,page.tsx:171-181).supabase.rpcreturns a network or server error rather than throwing, andreadCmsStatuseslogs it and goes on. The page then counts the drafts as read, with no sends.- Under Never sent, every draft is listed, and Select all and Send to CMS would send again pages that were already sent. Sent and Failed show "No page in this tab matches". The
.catchbranch hits the same issue on a first read, sincecmsis still empty. - Fix: have
readCmsStatusesthrow when a read fails. There's one chunk at the cap. On a failure with a Last send filter on, leave the ids unread and show the load error with Retry. The marks can show nothing, as they do now. - Add a test:
?sent=neverwith a failed read lists no row and offers Retry.
- Past the cap, the filter covers only the latest 500, and nothing says so (
page.tsx:576).- A send writes the draft's slug and meta, which bumps
updated_at, so recent sends sit near the top. But an older send, or an old page never sent, isn't listed past the cap. The cap's note is hidden while a filter is on. Created has the same gap. - Fix: while at the cap (
inTab.length < counts[tab]), keep a note even with a filter on, e.g. "Filters cover the 500 changed most recently of 1,240."
- A send writes the draft's slug and meta, which bumps
- Read the sends again when a CMS reports pages live (
page.tsx:207-209).- After
refreshWebflowPublishedmarks pages, the list is read again. The sends are read again only if the list's order changed. A page that was already first, or the only one, keeps its Sent mark, stays under Sent and stays out of Published until a reload. - This was already true of the mark. The filter now depends on it.
- Fix:
if (published.length) { setAttempt((n) => n + 1); setCmsAttempt((n) => n + 1); }. #1572 and #1580 add the same call for WordPress and Framer.
- After
- Docs.
content-editor.mdxis reformatted beyond the two lines: padded tables, re-wrapped Note and Tip, blank lines in the Steps, about 36 lines in all..prettierignorekeeps the docs MDX hand-formatted. Drop the unrelated changes.- In
send-to-cms.mdx:60, say what Published means here: "Published lists the pages your CMS reported live; a page you mark published yourself keeps its last send."
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The Library filter on the last send, left for later in phase 1 of Send to CMS (#1331, scope note of 2026-10-24). A Last send select beside Created lists the pages by how their last send to the CMS went: Never sent, Sending, Sent, Failed or Published (or Any).
content_draft_last_deliveries, 00262; a send left queued past its half hour reads as failed).?sent=failed), as Created is, and Export exports the rows it lists.draftsLastSentandSEND_FILTERSare inlib/content/drafts.ts, next todraftsCreatedIn. Strings are inen.json(contentEditor.library.lastSend). Docs: Send to CMS and the Content Editor guide.Related issue
Part of #1331 (phase 1 follow-up: "a Library filter on the last send").
Type of change
feat— New featurefix— Bug fixchore— Maintenance / dependenciesdocs— Documentation onlyrefactor— Code change that neither fixes a bug nor adds a featuretest— Adding or updating testsHow to test
cd web && yarn vitest run src/lib/content/drafts.test.ts 'src/app/[locale]/(dashboard)/dashboard/content/library/page.test.tsx'?sent=failed, and Export exports those./dashboard/content/library?sent=never: it shows, and lists every page.Checked in the browser at 1024 px, light and dark: the two selects sit under the tabs on the right, and the empty state reads as above.
Checklist
feature/,fix/,chore/,docs/) — see CONTRIBUTING.mdyarn lintpasses (run fromweb/)yarn typecheckpasses (run fromweb/)yarn format:checkpasses (run fromweb/)Also run:
yarn format,yarn lint(0 errors),yarn typecheck,yarn test(4,087 tests) andyarn buildinweb/. After the pre-push review's fixes: the Library page and drafts tests (50 + the drafts file), lint, typecheck, format check andyarn buildagain. Each fix's test fails without it.🤖 Generated with Claude Code