Skip to content

Conversation

@naaa760
Copy link

@naaa760 naaa760 commented Oct 23, 2025

PR Description for #8540

Fix react-hooks/purity ESLint error in SidebarMenuSkeleton component

  • Problem: The react-hooks/purity ESLint rule was flagging an error because Math.random() was being called inside a useMemo hook during render, which violates React's purity requirements.

  • Solution: Converted useMemo to useState with lazy initialization to ensure the random width calculation only happens once during component initialization, not on every render.

Changes made:

  • Updated SidebarMenuSkeleton component in all three variants (v4, www/default, www/new-york)
  • Replaced useMemo(() => Math.random()...) with useState(() => Math.random()...)
  • Added appropriate ESLint disable comment as per the suggested fix

@vercel
Copy link

vercel bot commented Oct 23, 2025

@naaa760 is attempting to deploy a commit to the shadcn-pro Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions
Copy link
Contributor

Looks like this PR modifies files in apps/www, which is deprecated.

Consider applying the change to apps/v4 if relevant.

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.

1 participant