Skip to content

Conversation

@SoonIter
Copy link
Member

@SoonIter SoonIter commented Aug 28, 2025

Summary

fix(plugin-api-docgen): too much apiDocMap clone in pageData cause performance issue in runtime

#2523

Related Issue

Checklist

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

@netlify
Copy link

netlify bot commented Aug 28, 2025

Deploy Preview for rspress-v2 ready!

Name Link
🔨 Latest commit 6e52308
🔍 Latest deploy log https://app.netlify.com/projects/rspress-v2/deploys/68bec64721387d00083957ac
😎 Deploy Preview https://deploy-preview-2524--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 Timeless0911 August 28, 2025 09:43
@SoonIter SoonIter enabled auto-merge (squash) August 28, 2025 09:45
Timeless0911
Timeless0911 previously approved these changes Aug 28, 2025
@SoonIter SoonIter force-pushed the syt/fix-api-doc-map branch from 6488276 to 6e52308 Compare September 8, 2025 12:04
Copilot AI review requested due to automatic review settings September 8, 2025 12:04
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 addresses a performance issue in the plugin-api-docgen by eliminating excessive cloning of the apiDocMap in pageData during runtime. The fix replaces the runtime page data approach with a compile-time global variable injection.

  • Moves apiDocMap from runtime pageData to a compile-time global variable
  • Removes the extendPageData hook that was creating multiple copies of apiDocMap
  • Uses webpack's define plugin to inject the apiDocMap data at build time

Reviewed Changes

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

File Description
packages/plugin-api-docgen/static/global-components/API.tsx Updates component to use global variable instead of pageData, reorganizes imports
packages/plugin-api-docgen/src/index.ts Removes pageData extension, adds global variable definition via builderConfig
packages/plugin-api-docgen/package.json Removes unnecessary index.d.ts from package files

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

@SoonIter SoonIter merged commit f288fe8 into main Sep 8, 2025
8 checks passed
@SoonIter SoonIter deleted the syt/fix-api-doc-map branch September 8, 2025 12:17
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