Skip to content

Memoize ClerkProvider appearance prop to prevent unnecessary re-renders#11

Closed
Copilot wants to merge 2 commits into
clerk-provider-expansionfrom
copilot/sub-pr-10
Closed

Memoize ClerkProvider appearance prop to prevent unnecessary re-renders#11
Copilot wants to merge 2 commits into
clerk-provider-expansionfrom
copilot/sub-pr-10

Conversation

Copilot AI commented Dec 5, 2025

Copy link
Copy Markdown
Contributor

The appearance prop in ClerkProvider was creating a new object on every render, triggering unnecessary re-renders of ClerkClerkProvider and its children.

Changes

  • Memoized the appearance object using React.useMemo with themeName as the dependency
  • The appearance object is now only recreated when themeName changes
const appearance = React.useMemo(() => {
  const theme = themeName ? themes[themeName as keyof typeof themes] : undefined;
  return theme ? { baseTheme: theme } : undefined;
}, [themeName]);

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

…nders

Co-authored-by: BSd3v <82055130+BSd3v@users.noreply.github.com>
Copilot AI changed the title [WIP] Update Clerk Provider to support themes and Dash feedback Memoize ClerkProvider appearance prop to prevent unnecessary re-renders Dec 5, 2025
Copilot AI requested a review from BSd3v December 5, 2025 20:26
@BSd3v BSd3v closed this Dec 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants