Repository navigation
Conversation
Content routes now return main's row when the requested branch has no row for a slug. The branch decides which row is used; publishedAt and noindex filters apply to that row afterwards, so a post that is unpublished or noindex on a branch stays hidden there. - Single-item routes look up the requested branch, then main. - List routes fetch the branch's slugs, then query the branch's rows plus main's rows for every other slug. - Chapters and versions use the same rule, so a post the branch moved to another collection or group no longer shows main's copy. - Related authors and a post's collection are read from both branches and narrowed to one row per slug. - chapterCount now counts published chapters for the requested locale after branch resolution, instead of posts across every branch and locale. Closes playfulprogramming#244
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configuration
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
Closes #244. Follows #277.
Content routes now return main's row when the requested branch has no row for a slug. This follows the two answers from Discord: the branch decides which row is used and the
publishedAtandnoindexfilters apply to that row afterwards, and the fallback stays ondb.querywith a second round trip instead of a single statement.How it works
/content/post/:slug,/content/authors/:slug) look up the requested branch, then main./content/posts,/content/collections,/content/authors) first fetch the slugs that exist on the requested branch, with no publish or noindex filter. The existing query then takes rows on the requested branch, or rows on main whose slug is not in that set. Filters, sorting and paging are unchanged and stay on that query.pickBranchRows.content/common.ts.Also changed
chapterCountused to count posts across every branch and locale. It now counts published chapters for the requested locale after branch resolution.authorsrelation on the post, posts and collections routes had no branch filter, so a post could get one author row per branch. It is now one row per author.Testing
pnpm test:unitpasses.main,pull/42andpull/7: only on main, edited on the branch, unpublished on the branch but published on main, noindex on the branch, moved out of its collection on the branch, and only on a third branch. All results matched the unit tests, and paging/content/postswith a small limit returned each slug once. The schema for that run came fromdrizzle-kit push, because the migrations fail on a fresh database on main (themisty_stickprimary key, which Implement same-image e2e testing using mockhttp + self-signed cert #262 fixes).Known gaps
Questions
noindexon the branch is still returned by/content/post/:slug, still listed as a chapter, and still counted inchapterCount. That matches main today. Should chapters andchapterCountexclude noindex posts?/content/collectionshas noorderBy, so its paging order is not deterministic. That predates this PR. Want it fixed here or as a separate issue?