-
Notifications
You must be signed in to change notification settings - Fork 431
include-drafts-in-dev-filter #1919
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Allow unpublished (published: false) articles to be visible in development by bypassing the published filter when import.meta.env.DEV is true. This change updates article filtering in several places (blog post view related articles, blog index, home page blog section, and sitemap generation) so that only production builds exclude unpublished content, making local development and previews include drafts. v
✅ Deploy Preview for hyprnote-storybook ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for hyprnote ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
📝 WalkthroughWalkthroughThis PR adds a new article about fault tolerance and modifies blog view routes to conditionally display unpublished articles in development mode. Article filters now check the DEV environment flag, bypassing the published constraint during development while preserving production behavior. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes
Pre-merge checks and finishing touches❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Comment |
|
The latest updates on your projects. Learn more about Argos notifications ↗︎
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
apps/web/src/routes/_view/index.tsx (1)
1676-1685: DEV draft inclusion is good, but date rendering should fall back tocreatedIncluding drafts in DEV via:
.filter((a) => import.meta.env.DEV || a.published !== false)is aligned with the other blog routes and keeps production behavior intact.
However, the card footer below currently assumes
article.updatedis always present:<time dateTime={article.updated} > {new Date(article.updated).toLocaleDateString("en-US", { … })} </time>Given that:
- Sorting already uses
a.updated || a.created, acknowledgingupdatedcan be missing, and- Newly added drafts like
fault-tolerance-boring-meeting-note.mdxonly specifycreatedin front‑matter,including drafts in DEV increases the chances of hitting an article without
updated, which would passundefinedintonew Date(...)and can throw at runtime.I’d mirror the sort logic by deriving a
displayDateonce and using it consistently:function BlogSection() { - const sortedArticles = allArticles - .filter((a) => import.meta.env.DEV || a.published !== false) - .sort((a, b) => { - const aDate = a.updated || a.created; - const bDate = b.updated || b.created; - return new Date(bDate).getTime() - new Date(aDate).getTime(); - }) - .slice(0, 3); + const sortedArticles = allArticles + .filter((a) => import.meta.env.DEV || a.published !== false) + .sort((a, b) => { + const aDate = a.updated || a.created; + const bDate = b.updated || b.created; + return new Date(bDate).getTime() - new Date(aDate).getTime(); + }) + .slice(0, 3); … <div className="flex items-center justify-between gap-4 pt-4 border-t border-neutral-100"> - <time - dateTime={article.updated} - className="text-xs text-neutral-500" - > - {new Date(article.updated).toLocaleDateString("en-US", { + {(() => { + const displayDate = article.updated || article.created; + return ( + <time + dateTime={displayDate} + className="text-xs text-neutral-500" + > + {new Date(displayDate).toLocaleDateString("en-US", { month: "short", day: "numeric", year: "numeric", - })} - </time> + })} + </time> + ); + })()}(or equivalently, compute
displayDateonce per article above the JSX).This keeps DEV behavior robust and consistent with your existing date handling elsewhere.
Also applies to: 1730-1740
🧹 Nitpick comments (1)
apps/web/content/articles/fault-tolerance-boring-meeting-note.mdx (1)
1-51: Minor metadata and copy polish for the new articleNothing blocking, but a few tweaks will make this ready to publish later:
created: "2025-11-30"is in the future relative to this PR; if you’re not intentionally future-dating the post, consider aligning it with the actual creation/publish date (it’s also used for sorting and display).- Line 28 looks like a leftover scratch link to a ChatGPT conversation (
https://chatgpt.com/...); consider removing or turning it into a proper reference if you expect readers to follow it.- A few small typos/grammar nits you may want to clean up:
- “The answe is” → “The answer is”
- “Desktop app is hard. Hardware/OS specific issues, limited observability since code runs on user's machine.” → maybe “Desktop apps are hard: hardware/OS‑specific issues and limited observability since code runs on the user's machine.”
- “We choose Tauri, which less mature than Electron, cause some delays/hussle” → “We chose Tauri, which is less mature than Electron, causing some delays/hassle.”
- “Ractor do not have supervisor implementation” → “Ractor does not have a supervisor implementation.”
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
apps/web/content/articles/fault-tolerance-boring-meeting-note.mdx(1 hunks)apps/web/src/routes/_view/blog/$slug.tsx(1 hunks)apps/web/src/routes/_view/blog/index.tsx(1 hunks)apps/web/src/routes/_view/index.tsx(1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
**/*.{ts,tsx}: Avoid creating a bunch of types/interfaces if they are not shared. Especially for function props, just inline them instead.
Never do manual state management for form/mutation. Use useForm (from tanstack-form) and useQuery/useMutation (from tanstack-query) instead for 99% of cases. Avoid patterns like setError.
If there are many classNames with conditional logic, usecn(import from@hypr/utils). It is similar toclsx. Always pass an array and split by logical grouping.
Usemotion/reactinstead offramer-motion.
Files:
apps/web/src/routes/_view/blog/index.tsxapps/web/src/routes/_view/blog/$slug.tsxapps/web/src/routes/_view/index.tsx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
- GitHub Check: Redirect rules - hyprnote-storybook
- GitHub Check: Header rules - hyprnote-storybook
- GitHub Check: Pages changed - hyprnote-storybook
- GitHub Check: Redirect rules - hyprnote
- GitHub Check: Header rules - hyprnote
- GitHub Check: Pages changed - hyprnote
🔇 Additional comments (2)
apps/web/src/routes/_view/blog/index.tsx (1)
27-30: DEV-only draft inclusion logic is correct and consistentUsing
import.meta.env.DEV || a.published !== falsecleanly exposes drafts in development while preserving production behavior where only explicitly-unpublished articles are hidden. This matches the pattern used elsewhere in the PR and should be tree-shaken correctly by Vite.apps/web/src/routes/_view/blog/$slug.tsx (1)
21-26: Related-articles filter now matches DEV behavior elsewhereThe updated predicate
a.slug !== article.slug && (import.meta.env.DEV || a.published !== false)keeps the current article out of the list, shows drafts only in DEV, and preserves existing production behavior. This keeps related-article behavior aligned with the blog index and home page.
No description provided.