You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Allow Clerk's unstyled button components to accept a single valid React element when React passes it as a one-item children array.
Keep the existing multiple-children error for real multi-child input.
Add a SignInButton regression test for the one-item array child shape.
Add a patch changeset for @clerk/react.
Context
SignInButton currently validates custom children with React.Children.only(). That is correct for normal JSX, but it also rejects one-item arrays. In a Next.js App Router server/client boundary, a custom child rendered through Show can reach the client button wrapper in that array shape even though the source JSX contains a single <button>.
The resulting runtime error says multiple children were passed to <SignInButton />, which is misleading for users who supplied one custom child.
This PR extends button component validation to accept a single React element passed as an array. The core change modifies assertSingleChild in childrenUtils.tsx to convert children to an array, validate exactly one valid React element exists, and return it or throw an error. A new test case verifies SignInButton correctly handles array-wrapped children and invokes both the child's click handler and clerk.redirectToSignIn. A changeset entry documents the patch release and new behavior.
The title 'fix(react): accept single array child in unstyled buttons' clearly and concisely summarizes the main change: enabling unstyled button components to accept a single child passed as an array.
Description check
✅ Passed
The description is well-related to the changeset, explaining the problem context, the solution, and listing all key changes including the validation logic update, test addition, and changeset creation.
Docstring Coverage
✅ Passed
No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check
✅ Passed
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
✅ Passed
Check skipped because no linked issues were found for this pull request.
✏️ Tip: You can configure your own custom pre-merge checks in the settings.
Tip
💬 Introducing Slack Agent: The best way for teams to turn conversations into code.
Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Generate code and open pull requests
Plan features and break down work
Investigate incidents and troubleshoot customer tickets together
Automate recurring tasks and respond to alerts with triggers
Summarize progress and report instantly
Built for teams:
Shared memory across your entire org—no repeating context
Per-thread sandboxes to safely plan and execute work
Governance built-in—scoped access, auditability, and budget controls
One agent for your entire SDLC. Right inside Slack.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
SignInButtonregression test for the one-item array child shape.@clerk/react.Context
SignInButtoncurrently validates custom children withReact.Children.only(). That is correct for normal JSX, but it also rejects one-item arrays. In a Next.js App Router server/client boundary, a custom child rendered throughShowcan reach the client button wrapper in that array shape even though the source JSX contains a single<button>.The resulting runtime error says multiple children were passed to
<SignInButton />, which is misleading for users who supplied one custom child.