Skip to content

Conversation

@yujonglee
Copy link
Contributor

No description provided.

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
@netlify
Copy link

netlify bot commented Nov 26, 2025

Deploy Preview for hyprnote-storybook ready!

Name Link
🔨 Latest commit f1b7377
🔍 Latest deploy log https://app.netlify.com/projects/hyprnote-storybook/deploys/6926c2cbcab163000862c0ef
😎 Deploy Preview https://deploy-preview-1919--hyprnote-storybook.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify
Copy link

netlify bot commented Nov 26, 2025

Deploy Preview for hyprnote ready!

Name Link
🔨 Latest commit f1b7377
🔍 Latest deploy log https://app.netlify.com/projects/hyprnote/deploys/6926c2cbcab163000862c0ed
😎 Deploy Preview https://deploy-preview-1919--hyprnote.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 26, 2025

📝 Walkthrough

Walkthrough

This 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

Cohort / File(s) Change Summary
New Article
apps/web/content/articles/fault-tolerance-boring-meeting-note.mdx
Adds new MDX article with front-matter metadata (title, description, author, dates) and comprehensive content on fault tolerance in Hyprnote, including architecture diagrams and strategy patterns
Blog Route Filters
apps/web/src/routes/_view/blog/$slug.tsx, apps/web/src/routes/_view/blog/index.tsx, apps/web/src/routes/_view/index.tsx
Modified article filtering logic to conditionally include unpublished articles in DEV environment via import.meta.env.DEV check, preserving production behavior

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

  • Verify the article front-matter metadata and content structure are correct
  • Confirm the DEV environment checks are applied consistently across all three route files and don't inadvertently expose unpublished content in production

Pre-merge checks and finishing touches

❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Description check ❓ Inconclusive No pull request description was provided by the author, making it impossible to assess relevance to the changeset. Add a description explaining the purpose and motivation for including drafts in the dev environment filter.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title 'include-drafts-in-dev-filter' clearly and specifically describes the main change: conditionally including draft/unpublished articles in development environments.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch include-drafts-in-dev-filter

Comment @coderabbitai help to get the list of available commands and usage tips.

@argos-ci
Copy link

argos-ci bot commented Nov 26, 2025

The latest updates on your projects. Learn more about Argos notifications ↗︎

Build Status Details Updated (UTC)
web (Inspect) ⚠️ Changes detected (Review) 3 changed Nov 26, 2025, 9:08 AM

@yujonglee yujonglee merged commit 254faca into main Nov 26, 2025
10 of 12 checks passed
@yujonglee yujonglee deleted the include-drafts-in-dev-filter branch November 26, 2025 09:10
Copy link
Contributor

@coderabbitai coderabbitai bot left a 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 to created

Including 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.updated is always present:

<time
  dateTime={article.updated}
>
  {new Date(article.updated).toLocaleDateString("en-US", {})}
</time>

Given that:

  • Sorting already uses a.updated || a.created, acknowledging updated can be missing, and
  • Newly added drafts like fault-tolerance-boring-meeting-note.mdx only specify created in front‑matter,

including drafts in DEV increases the chances of hitting an article without updated, which would pass undefined into new Date(...) and can throw at runtime.

I’d mirror the sort logic by deriving a displayDate once 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 displayDate once 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 article

Nothing 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

📥 Commits

Reviewing files that changed from the base of the PR and between 227ba46 and f1b7377.

📒 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, use cn (import from @hypr/utils). It is similar to clsx. Always pass an array and split by logical grouping.
Use motion/react instead of framer-motion.

Files:

  • apps/web/src/routes/_view/blog/index.tsx
  • apps/web/src/routes/_view/blog/$slug.tsx
  • apps/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 consistent

Using import.meta.env.DEV || a.published !== false cleanly 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 elsewhere

The 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants