Skip to content

fix: do not modify singleton global sidebar#2911

Merged
SoonIter merged 1 commit intoweb-infra-dev:mainfrom
JounQin:fix/sidebar
Dec 22, 2025
Merged

fix: do not modify singleton global sidebar#2911
SoonIter merged 1 commit intoweb-infra-dev:mainfrom
JounQin:fix/sidebar

Conversation

@JounQin
Copy link
Copy Markdown
Collaborator

@JounQin JounQin commented Dec 19, 2025

Summary

do not modify singleton global sidebar

Related Issue

close #2910

Checklist

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

Copilot AI review requested due to automatic review settings December 19, 2025 06:53
@netlify
Copy link
Copy Markdown

netlify bot commented Dec 19, 2025

Deploy Preview for rspress-v2 ready!

Name Link
🔨 Latest commit 488d954
🔍 Latest deploy log https://app.netlify.com/projects/rspress-v2/deploys/6944f69172cfdd0008d55f3c
😎 Deploy Preview https://deploy-preview-2911--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
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 fixes a bug where the singleton global sidebar object was being mutated directly, which could cause unexpected state sharing between components. The fix adds a deep clone of the sidebar data before modification.

  • Added structuredClone() call to create a deep copy of the sidebar data before modifying the collapsed property

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown
Member

@SoonIter SoonIter left a comment

Choose a reason for hiding this comment

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

thanks

@SoonIter SoonIter merged commit 3ec6aec into web-infra-dev:main Dec 22, 2025
9 checks passed
@JounQin JounQin deleted the fix/sidebar branch December 22, 2025 03:27
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.

[Bug]: createInitialSidebar modifies singleton global sidebar data which breaks SSG

3 participants