Skip to content

Conversation

@SoonIter
Copy link
Member

@SoonIter SoonIter commented Oct 21, 2025

Summary

perf: simple matchRoutes alternative #1863

img_v3_02r9_7c7d92b3-356d-4e00-9925-6ea8ac88acbg

Related Issue

Checklist

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

Copilot AI review requested due to automatic review settings October 21, 2025 10:39
@netlify
Copy link

netlify bot commented Oct 21, 2025

Deploy Preview for rspress-v2 ready!

Name Link
🔨 Latest commit 9575dac
🔍 Latest deploy log https://app.netlify.com/projects/rspress-v2/deploys/68f762d1be892c0008001ab7
😎 Deploy Preview https://deploy-preview-2673--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.

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 implements a performance-optimized alternative to react-router-dom's matchRoutes and matchPath functions by creating custom implementations that are better suited for the project's specific use case of matching static routes.

Key changes:

  • Custom matchPath and matchRoutes implementations replacing react-router-dom imports
  • Pre-sorted routes array for faster matching (longest paths first)
  • Route path normalization helper for consistent matching behavior

Reviewed Changes

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

File Description
packages/runtime/src/route.ts Implements custom matchPath and matchRoutes functions with route normalization, removes react-router-dom dependency
packages/runtime/src/route.test.ts Adds comprehensive test coverage for new matchPath and isActive functions, includes edge cases for path normalization

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@SoonIter SoonIter merged commit 8bc7250 into main Oct 21, 2025
13 checks passed
@SoonIter SoonIter deleted the syt/perf-ssg branch October 21, 2025 11:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants