Skip to content

Conversation

@JounQin
Copy link
Member

@JounQin JounQin commented Aug 15, 2025

Summary by CodeRabbit

  • Chores
    • Upgraded dependencies across the project, including the site framework to the latest beta.
    • Prepared a patch release entry.
  • Refactor
    • Updated overview sidebar to use a more consistent runtime data source.
    • Adjusted PDF export title and outline handling for more consistent parsing.
  • Build/Config
    • Disabled dead link checks during markdown builds.
  • Style
    • Added targeted ESLint suppressions to reduce false-positive warnings.

@JounQin JounQin self-assigned this Aug 15, 2025
Copilot AI review requested due to automatic review settings August 15, 2025 03:18
@JounQin JounQin added the dependencies Pull requests that update a dependency file label Aug 15, 2025
@changeset-bot
Copy link

changeset-bot bot commented Aug 15, 2025

🦋 Changeset detected

Latest commit: 7b02d65

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@alauda/doom Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai
Copy link

coderabbitai bot commented Aug 15, 2025

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Walkthrough

Patch release changeset added. package.json dependencies bumped (notably rspress to 2.0.0-beta.26). Several files add ESLint suppression comments. Overview now uses useSidebar() instead of useSidebarData(). Minor code tweaks in PDF export (removed optional chaining) and a config change removing markdown.checkDeadLinks.

Changes

Cohort / File(s) Summary
Release/Changeset
.changeset/eleven-files-nail.md
Adds changeset for patch release and rspress bump note.
Dependency Version Bumps
package.json
Upgrades numerous dependencies/devDependencies; rspress-related packages to 2.0.0-beta.26; no adds/removals.
PDF Export Title Handling
src/cli/html-export-pdf/core/outline.ts, src/cli/html-export-pdf/core/printer.ts
Removed optional chaining on textContent.trim(); now assumes non-null textContent.
CLI Config (Markdown)
src/cli/load-config.ts
Removes markdown.checkDeadLinks: true from returned config.
Lint Suppressions (Runtime/Global)
src/global/SiteOverrides/index.tsx, src/global/VersionsNav/index.tsx, src/runtime/components/ExternalSiteLink.tsx, src/runtime/components/OpenAPIPath.tsx, src/runtime/components/OpenAPIRef.tsx, src/theme.tsx
Adds ESLint disable-next-line for no-deprecated around usePageData usage; no runtime changes.
Overview Sidebar Source Switch
src/runtime/components/Overview.tsx
Switches from theme useSidebarData() to runtime useSidebar(); adjusts imports; adds lint suppression.
Hook Cleanup
src/runtime/hooks/useIsPrint.ts
Drops redundant boolean coercion on matchMedia matches.

Sequence Diagram(s)

sequenceDiagram
  participant U as User
  participant Overview as Overview Component
  participant R as @rspress/core/runtime
  U->>Overview: Render
  Overview->>R: useSidebar()
  R-->>Overview: Sidebar groups array
  Overview-->>U: Rendered overview with groups
Loading
sequenceDiagram
  participant CLI as CLI pdf()
  participant DOM as Document
  participant P as Printer
  CLI->>P: generate PDF
  P->>DOM: query title / headings
  DOM-->>P: title.textContent, h*.textContent
  P->>P: trim() without null checks
  P-->>CLI: PDF output or throw on null textContent
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

Suggested labels

upstream

Poem

I thump my paws—new betas hop in line,
Sidebars shift, the pages still align.
Titles trimmed, the links now roam,
Lints hush softly—burrows feel like home.
With whiskered zeal, I stamp this deed:
“Ship it!” squeaks the rabbit—full speed! 🐇✨

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch chore/deps

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.

❤️ 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.
    • 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.
  • 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 the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

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

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • 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.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR bumps the rspress framework to version 2.0.0-beta.26, updating dependencies and adapting code to handle deprecation warnings and API changes.

  • Updates rspress core dependencies from beta.22 to beta.26
  • Replaces deprecated useSidebarData with useSidebar hook
  • Adds ESLint disable comments for deprecated usePageData usage
  • Removes unnecessary type assertions and config options

Reviewed Changes

Copilot reviewed 12 out of 13 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
package.json Updates rspress and related dependencies to beta.26 versions
src/runtime/components/Overview.tsx Replaces deprecated useSidebarData with useSidebar hook
src/runtime/hooks/useIsPrint.ts Removes unnecessary boolean coercion
src/cli/load-config.ts Removes deprecated checkDeadLinks configuration
Multiple component files Adds ESLint disable comments for deprecated usePageData usage
PDF processing files Removes unnecessary optional chaining with non-null assertions

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.

Signed-off-by: JounQin <admin@1stg.me>
@pkg-pr-new
Copy link

pkg-pr-new bot commented Aug 15, 2025

Open in StackBlitz

yarn add https://pkg.pr.new/@alauda/doom@147.tgz

commit: 7b02d65

Copy link

@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

♻️ Duplicate comments (2)
src/cli/html-export-pdf/core/printer.ts (1)

210-216: Potential runtime error: title.textContent can be null

If <title> exists but its textContent is null, .trim() will throw and unnecessarily abort PDF generation. Use a safe fallback.

Apply this diff:

-          meta.title = title.textContent.trim()
+          meta.title = (title.textContent ?? '').trim()

Optional: you could also use document.title which is always a string:

meta.title = document.title.trim()
src/cli/html-export-pdf/core/outline.ts (1)

109-114: Potential runtime error: tag.textContent can be null

Directly calling .trim() on tag.textContent risks a crash if it’s null, which would break outline extraction for PDFs.

Apply this diff:

-            title: tag.textContent.trim().replace(/^#|#$/, ''),
+            title: (tag.textContent ?? '').trim().replace(/^#|#$/, ''),
🧹 Nitpick comments (5)
src/global/SiteOverrides/index.tsx (1)

37-38: Inline no-deprecated suppression is fine given upstream constraints

Acceptable localized suppression until usePage (or an equivalent) is exported from the runtime. Please track migration to the non-deprecated API when it becomes available.

Would you like me to open a follow-up issue to track the migration away from usePageData()?

src/runtime/hooks/useIsPrint.ts (1)

28-30: Redundant boolean coercion removal is correct

mqList.matches is already boolean; using it directly is cleaner.

For consistency, consider aligning the initial state too:

// current
const [isPrint, changeIsPrint] = useState(!!printMediaQuery?.matches)
// suggested
const [isPrint, changeIsPrint] = useState(printMediaQuery?.matches ?? false)
src/theme.tsx (1)

95-99: Prefer placing ESLint directive above the statement for consistency

The inline directive inside the destructuring works, but placing it on the line above the usePageData() statement matches the pattern used elsewhere in the repo and reads cleaner.

Apply this diff to reposition the directive:

 export const Layout = () => {
-  const {
-    siteData: { lang: siteLang, themeConfig },
-    // eslint-disable-next-line @typescript-eslint/no-deprecated -- `usePage` is not exported...
-  } = usePageData()
+  // eslint-disable-next-line @typescript-eslint/no-deprecated -- `usePage` is not exported...
+  const {
+    siteData: { lang: siteLang, themeConfig },
+  } = usePageData()
src/runtime/components/Overview.tsx (2)

66-67: Localized eslint suppression is fine; add a TODO to track migration

This is a pragmatic workaround until a supported replacement is exported. Consider adding a TODO to revisit when usePage (or equivalent) becomes available.

Apply this diff to document the intent:

-    // eslint-disable-next-line @typescript-eslint/no-deprecated -- `usePage` is not exported...
+    // TODO: migrate away from usePageData when a supported `usePage` (or equivalent) is exported upstream.
+    // eslint-disable-next-line @typescript-eslint/no-deprecated -- `usePage` is not exported...

86-97: Defensive guard when narrowing sidebar by route

If findItemByRoutePath returns an empty array (or a non-array), this reassignment could unintentionally drop the sidebar groups. Add a small guard to keep the original value in that case.

Apply this diff:

-    overviewSidebarGroups = findItemByRoutePath(
-      overviewSidebarGroups,
-      routePath,
-    )
+    const resolved = findItemByRoutePath(overviewSidebarGroups, routePath)
+    if (Array.isArray(resolved) && resolved.length) {
+      overviewSidebarGroups = resolved
+    }

If helpful, I can also check the return type of findItemByRoutePath across the repo to confirm it always returns an array.

📜 Review details

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

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between dd87f8f and 7b02d65.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (13)
  • .changeset/eleven-files-nail.md (1 hunks)
  • package.json (3 hunks)
  • src/cli/html-export-pdf/core/outline.ts (1 hunks)
  • src/cli/html-export-pdf/core/printer.ts (1 hunks)
  • src/cli/load-config.ts (0 hunks)
  • src/global/SiteOverrides/index.tsx (1 hunks)
  • src/global/VersionsNav/index.tsx (1 hunks)
  • src/runtime/components/ExternalSiteLink.tsx (1 hunks)
  • src/runtime/components/OpenAPIPath.tsx (1 hunks)
  • src/runtime/components/OpenAPIRef.tsx (1 hunks)
  • src/runtime/components/Overview.tsx (3 hunks)
  • src/runtime/hooks/useIsPrint.ts (1 hunks)
  • src/theme.tsx (1 hunks)
💤 Files with no reviewable changes (1)
  • src/cli/load-config.ts
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2025-05-26T08:59:41.491Z
Learnt from: JounQin
PR: alauda/doom#30
File: src/runtime/components/K8sCrd.tsx:5-5
Timestamp: 2025-05-26T08:59:41.491Z
Learning: In rspress/core v2.0.0-beta.7, the '/theme' export is available in the package exports field as `"./theme": { "default": "./theme.ts" }`, so imports like `import { Badge, Button } from 'rspress/core/theme'` are valid even if ESLint shows resolution errors.

Applied to files:

  • src/theme.tsx
📚 Learning: 2025-06-06T07:08:55.881Z
Learnt from: JounQin
PR: alauda/doom#69
File: package.json:101-101
Timestamp: 2025-06-06T07:08:55.881Z
Learning: When a package has peer dependencies that require TypeScript (like `eslint-react/eslint-plugin`), TypeScript should be moved from devDependencies to dependencies to satisfy the peer dependency requirement.

Applied to files:

  • package.json
🔇 Additional comments (9)
src/runtime/components/OpenAPIPath.tsx (1)

184-185: Local deprecation suppression is fine — centralization optional.

I searched the repo: usePageData appears in 9 places (7 runtime code files + 2 docs). All runtime call sites already use a localized
// eslint-disable-next-line @typescript-eslint/no-deprecated comment, so no immediate change is required.

Call sites found:

  • src/runtime/components/OpenAPIPath.tsx (line ~185)
  • src/runtime/components/OpenAPIRef.tsx (line ~168)
  • src/runtime/components/ExternalSiteLink.tsx (line ~35)
  • src/runtime/components/Overview.tsx (line ~66–67)
  • src/global/VersionsNav/index.tsx (line ~49)
  • src/global/SiteOverrides/index.tsx (line ~38)
  • src/theme.tsx (line ~98)
  • docs/en/usage/mdx.mdx (example)
  • docs/zh/usage/mdx.mdx (example)

Recommendation — optional:

  • Keep the localized suppressions as-is for now.
  • If you prefer a single change point for a future migration, add a compat hook that wraps usePageData and centralizes the eslint suppression, export it from your hooks index, and replace runtime usages with it.

Optional diff (if you choose to centralize):

-  // eslint-disable-next-line @typescript-eslint/no-deprecated -- `usePage` is not exported...
-  const { page } = usePageData()
+  const { page } = usePageCompat()

Add compat hook:

// src/runtime/hooks/usePageCompat.ts
import { usePageData } from '@rspress/core/runtime'

// eslint-disable-next-line @typescript-eslint/no-deprecated -- centralized until `usePage` is exported
export const usePageCompat = () => usePageData()

Then export/use it from your hooks index or import directly as needed. No fixes required right now — this is an optional cleanup for future ease of migration.

src/global/VersionsNav/index.tsx (1)

48-50: LGTM: targeted lint suppression above usePageData().

Keeping the suppression scoped to the exact line minimizes collateral impact and maintains clarity. Consider removing it once usePage (or an equivalent non-deprecated hook) becomes available from the runtime.

src/runtime/components/OpenAPIRef.tsx (1)

167-169: LGTM: localized suppression is appropriate here.

This mirrors the pattern elsewhere and keeps the linter happy without changing runtime behavior. When feasible, migrate to a compat hook to avoid repeating suppressions across files.

.changeset/eleven-files-nail.md (1)

1-5: LGTM: patch changeset reads clearly and matches the dependency bump.

No further action needed.

src/runtime/components/ExternalSiteLink.tsx (1)

34-36: LGTM: scoped deprecation suppression above usePageData().

This is consistent with the approach used elsewhere. The constructed URL remains unaffected, and security headers (noopener noreferrer) are intact.

src/runtime/components/Overview.tsx (2)

10-11: Switch to runtime useSidebar hook looks correct for rspress v2.0.0-beta.26

Good move to consume sidebar from runtime. This aligns with the new public API and decouples from theme internals.


12-12: No remaining useSidebarData references found — verification complete

Searches across the repo returned no imports/usages/property accesses of useSidebarData. The codebase uses the new hook:

  • src/runtime/components/Overview.tsx — usage: let overviewSidebarGroups = useSidebar() (around line 86); imports show useSidebar from @rspress/core/runtime and theme imports at line 12 do not include useSidebarData.
package.json (2)

70-74: Rspress stack coherently bumped to beta.26

All core/shared/plugins are aligned on 2.0.0-beta.26, which reduces cross-version friction. The accompanying code changes (e.g., useSidebar migration) reflect this update.


122-124: TS toolchain bumps look consistent

typescript and typescript-eslint are bumped together, and TypeScript remains in dependencies (not dev), matching the prior learning about satisfying peer deps. Looks good.

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

Labels

dependencies Pull requests that update a dependency file

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants