Skip to content

docs: eagerly load comments section - #6511

Merged
juliusmarminge merged 3 commits into
nextfrom
eager-load-comments
Feb 18, 2025
Merged

juliusmarminge merged 3 commits into
nextfrom
eager-load-comments

Conversation

@juliusmarminge

@juliusmarminge juliusmarminge commented Feb 18, 2025 •

Copy link
Copy Markdown
Member

Summary by CodeRabbit

  • New Features
    • Upgraded the blog comments section with a new discussion system that adapts to both light and dark themes, ensuring a more engaging and interactive commenting experience.

@juliusmarminge
juliusmarminge requested a review from a team as a code owner February 18, 2025 01:13
@coderabbitai

coderabbitai Bot commented Feb 18, 2025 •

Copy link
Copy Markdown
Contributor

Warning

Rate limit exceeded

@juliusmarminge has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 25 minutes and 28 seconds before requesting another review.

βŒ› How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

πŸ“₯ Commits

Reviewing files that changed from the base of the PR and between 0193921 and 8113094.

πŸ“’ Files selected for processing (2)
  • www/src/theme/BlogPostItem/index.tsx (2 hunks)
  • www/src/theme/BlogPostPage/Metadata/index.tsx (1 hunks)

Walkthrough

The changes remove the existing BlogComments component and update the blog post item to utilize the Giscus component directly. The BlogComments file, which previously used the Docusaurus useColorMode hook for setting themes, is deleted. Meanwhile, modifications in the blog post item include the removal of BlogComments, the introduction of a new Giscus import, and updates to the rendering logic and props configuration, including a new BlogPostItemWrapper.

Changes

File(s) Change Summary
www/src/components/BlogComments.tsx Deleted BlogComments component that rendered comments via Giscus and used the Docusaurus theme for determining color mode.
www/src/theme/BlogPostItem/index.tsx Removed BlogComments import and logic; added a new Giscus import with updated properties for comment rendering, including a new BlogPostItemWrapper function.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant BlogPostItem
    participant Giscus

    User->>BlogPostItem: Load Blog Post Page
    BlogPostItem->>useColorMode: Retrieve current color mode
    BlogPostItem->>Giscus: Render Giscus with configured comment props
    Giscus-->>User: Display comments thread
Loading

Poem

Hoppin' through code in moonlit lanes,
I leave behind old comments’ remains.
With Giscus now taking the stage,
New chats bloom on every page!
A bunny smiles as code evolves free,
Leaping high in pure glee!
🐰✨


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❀️ Share
πŸͺ§ Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@vercel

vercel Bot commented Feb 18, 2025 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for Git β†—οΈŽ

Name Status Preview Comments Updated (UTC)
next-prisma-starter βœ… Ready (Inspect) Visit Preview Feb 18, 2025 1:20am
og-image βœ… Ready (Inspect) Visit Preview πŸ’¬ Add feedback Feb 18, 2025 1:20am
www βœ… Ready (Inspect) Visit Preview πŸ’¬ Add feedback Feb 18, 2025 1:20am

@railway-app

railway-app Bot commented Feb 18, 2025 •

Copy link
Copy Markdown

πŸš… Previously deployed to Railway in the trpc-sse-and-websockets project. Environment has been deleted.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (2)
www/src/theme/BlogPostItem/index.tsx (2)

7-13: Consider adding proper TypeScript types.

The component uses any type for props which reduces type safety. Consider defining proper types:

-export default function BlogPostItemWrapper(props: any) {
+import type { Props as BlogPostItemProps } from '@theme-original/BlogPostItem';
+
+export default function BlogPostItemWrapper(props: BlogPostItemProps) {

17-30: Consider extracting Giscus configuration to a separate file.

The Giscus configuration contains hardcoded values that might be better managed in a dedicated configuration file.

+// giscus.config.ts
+export const giscusConfig = {
+  repo: "trpc/trpc",
+  repoId: "MDEwOlJlcG9zaXRvcnkyODA1NTcwNTQ",
+  mapping: "number",
+  strict: "0",
+  reactionsEnabled: "1",
+  emitMetadata: "1",
+  inputPosition: "top",
+  lang: "en",
+} as const;

Then update the component:

-        <Giscus
-          repo="trpc/trpc"
-          repoId="MDEwOlJlcG9zaXRvcnkyODA1NTcwNTQ"
-          mapping="number"
-          term={commentDiscussionId as string}
-          strict="0"
-          reactionsEnabled="1"
-          emitMetadata="1"
-          inputPosition="top"
-          theme={colorMode}
-          lang="en"
-        />
+        <Giscus
+          {...giscusConfig}
+          term={commentDiscussionId as string}
+          theme={colorMode}
+        />
πŸ“œ Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

πŸ“₯ Commits

Reviewing files that changed from the base of the PR and between eb8b469 and 0193921.

πŸ“’ Files selected for processing (2)
  • www/src/components/BlogComments.tsx (0 hunks)
  • www/src/theme/BlogPostItem/index.tsx (2 hunks)
πŸ’€ Files with no reviewable changes (1)
  • www/src/components/BlogComments.tsx
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: test
  • GitHub Check: Lint and auto-fix
πŸ”‡ Additional comments (1)
www/src/theme/BlogPostItem/index.tsx (1)

1-6: LGTM! Import statements are well-organized.

The new imports for useColorMode and Giscus are appropriate for the comment system integration.

Comment on lines +19 to +20
repo="trpc/trpc"
repoId="MDEwOlJlcG9zaXRvcnkyODA1NTcwNTQ"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

πŸ’‘ Verification agent

🧩 Analysis chain

Verify the repository configuration.

Please verify that the hardcoded repository details are correct:


🏁 Script executed:

#!/bin/bash
# Description: Verify that the repository ID matches the trpc/trpc repository

# Test: Query GitHub API for the repository ID
gh api graphql -f query='
query {
  repository(owner: "trpc", name: "trpc") {
    id
    databaseId
  }
}'

Length of output: 197


Mismatch in Repository ID: Update Required

The GitHub API query confirms that the correct repository ID for trpc/trpc is "MDEwOlJlcG9zaXRvcnkyODA1NTcwNTQ=", which includes a trailing =. Currently, the code specifies the repository ID as "MDEwOlJlcG9zaXRvcnkyODA1NTcwNTQ" (missing the trailing =). Please update this value to match the verified API response.

  • File: www/src/theme/BlogPostItem/index.tsx (Line 20)
  • Change diff:
    - repoId="MDEwOlJlcG9zaXRvcnkyODA1NTcwNTQ"
    + repoId="MDEwOlJlcG9zaXRvcnkyODA1NTcwNTQ="
πŸ“ Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
repo="trpc/trpc"
repoId="MDEwOlJlcG9zaXRvcnkyODA1NTcwNTQ"
repo="trpc/trpc"
- repoId="MDEwOlJlcG9zaXRvcnkyODA1NTcwNTQ"
+ repoId="MDEwOlJlcG9zaXRvcnkyODA1NTcwNTQ="

@pkg-pr-new

pkg-pr-new Bot commented Feb 18, 2025

Copy link
Copy Markdown

Open in Stackblitz

@trpc/client

npm i https://pkg.pr.new/trpc/trpc/@trpc/client@6511

@trpc/next

npm i https://pkg.pr.new/trpc/trpc/@trpc/next@6511

@trpc/server

npm i https://pkg.pr.new/trpc/trpc/@trpc/server@6511

@trpc/react-query

npm i https://pkg.pr.new/trpc/trpc/@trpc/react-query@6511

@trpc/tanstack-react-query

npm i https://pkg.pr.new/trpc/trpc/@trpc/tanstack-react-query@6511

@trpc/upgrade

npm i https://pkg.pr.new/trpc/trpc/@trpc/upgrade@6511

commit: 8113094

@github-actions

Copy link
Copy Markdown
Contributor

This pull request has been locked because we are very unlikely to see comments on closed issues. If you think, this PR is still necessary, create a new one with the same branch. Thank you.

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Feb 19, 2025

This branch was successfully deployed

5 active deployments
Preview – www β€” 81130941 Deployed Feb 18, 2025 by vercel[bot]
Preview – examples-todomvc β€” 81130941 Deployed Feb 18, 2025 by vercel[bot]
Preview – trpc-next-app-dir β€” 81130941 Deployed Feb 18, 2025 by vercel[bot]
Preview – next-prisma-starter β€” 81130941 Deployed Feb 18, 2025 by vercel[bot]
Preview – og-image β€” 81130941 Deployed Feb 18, 2025 by vercel[bot]
trpc-pr-6511 β€” 81130941 Deployed Feb 18, 2025 by railway-app[bot]
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant