-
Notifications
You must be signed in to change notification settings - Fork 40
refactor: remove useless code #2916
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| <div> | ||
| {isCollapsed !== undefined && ( | ||
| <button | ||
| onClick={() => setIsCollapsed((v) => !v)} | ||
| className="collapsible-btn" | ||
| aria-expanded={!isCollapsed} | ||
| > | ||
| <span className={`collapsible-icon ${isCollapsed ? "" : "open"}`}> | ||
| <DownArrow width={16} height={16} /> | ||
| </span> | ||
| {isCollapsed ? "Show Details" : "Hide Details"} | ||
| </button> | ||
| )} | ||
| {childrenArray?.[0]} | ||
| {isCollapsed !== undefined ? ( | ||
| <> {isCollapsed ? null : childrenArray?.slice(1)}</> | ||
| ) : ( | ||
| childrenArray?.slice(1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Collapsed content hides headings when markdown adds leading whitespace
The new collapse rendering keeps childrenArray[0] visible and hides slice(1) when defaultCollapsed is defined. In MDX usage the first child is commonly the whitespace string that separates the opening tag from the first heading (e.g. {"\n"}, then <h2>). As soon as defaultCollapsed is true, the heading and the rest of the content live in childrenArray[1...] and are therefore hidden, so a collapsed release-note block renders only the toggle button without the version title. The previous implementation injected the button after the first <h2> so the header always remained visible. Consider skipping leading text nodes or explicitly preserving the first element node before hiding the remaining children.
Useful? React with 👍 / 👎.
fix: step-content