Skip to content

refactor(runtime): split hooks into several files#2454

Merged
SoonIter merged 7 commits intomainfrom
syt/hooks-split
Aug 7, 2025
Merged

refactor(runtime): split hooks into several files#2454
SoonIter merged 7 commits intomainfrom
syt/hooks-split

Conversation

@SoonIter
Copy link
Copy Markdown
Member

@SoonIter SoonIter commented Aug 7, 2025

Summary

refactor(runtime): split hooks into several files

Related Issue

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

Copilot AI review requested due to automatic review settings August 7, 2025 11:49
@netlify
Copy link
Copy Markdown

netlify Bot commented Aug 7, 2025

Deploy Preview for rspress ready!

Name Link
🔨 Latest commit 3a1adf5
🔍 Latest deploy log https://app.netlify.com/projects/rspress/deploys/689497c7b058ed0008ed987c
😎 Deploy Preview https://deploy-preview-2454--rspress.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 63 (🔴 down 31 from production)
Accessibility: 97 (no change from production)
Best Practices: 92 (🟢 up 9 from production)
SEO: 100 (no change from production)
PWA: -
View the detailed breakdown and full score reports

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

This comment was marked as outdated.

@netlify
Copy link
Copy Markdown

netlify Bot commented Aug 7, 2025

Deploy Preview for rspress-v2 ready!

Name Link
🔨 Latest commit 3a1adf5
🔍 Latest deploy log https://app.netlify.com/projects/rspress-v2/deploys/689497c75869810008aa82e1
😎 Deploy Preview https://deploy-preview-2454--rspress-v2.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.

@SoonIter SoonIter requested a review from Copilot August 7, 2025 12:13
Copy link
Copy Markdown
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 refactors the hooks in the runtime package by splitting them from a single monolithic file into separate, focused files. The refactoring also consolidates duplicated functionality across the theme-default package.

Key changes:

  • Split runtime hooks from a single file into separate hook files for better organization
  • Move sidebar and navigation utilities from theme-default to runtime for better reusability
  • Update all import statements across the codebase to use the new hook structure

Reviewed Changes

Copilot reviewed 52 out of 52 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
packages/runtime/src/hooks.ts Removed large monolithic hooks file
packages/runtime/src/hooks/*.ts Added individual hook files (useDark, useFrontmatter, useI18n, etc.)
packages/runtime/src/hooks/useSidebar.ts Moved sidebar logic from theme-default with getSidebarDataGroup function
packages/runtime/src/route.ts Added isActive function moved from theme-default
packages/theme-default/src/**/*.ts Updated imports to use new hook structure from runtime
packages/theme-default/src/logic/*.ts Removed files that were moved to runtime
packages/shared/src/types/defaultTheme.ts Moved SidebarData type definition and updated NormalizedSidebarGroup

Comment thread packages/runtime/src/hooks/useLocaleSiteData.ts
Comment thread packages/runtime/src/hooks/usePageData.ts
Comment thread packages/runtime/src/route.ts
@SoonIter SoonIter requested a review from Timeless0911 August 7, 2025 12:43
@SoonIter SoonIter merged commit 2b49314 into main Aug 7, 2025
11 checks passed
@SoonIter SoonIter deleted the syt/hooks-split branch August 7, 2025 12:59
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.

4 participants