Skip to content

fix: Stats and StatsGl don't remove previous class names on rerender#1994

Merged
CodyJasonBennett merged 2 commits intopmndrs:masterfrom
lukehorvat:StatsGl-classNames-cleanup
Jun 15, 2024
Merged

fix: Stats and StatsGl don't remove previous class names on rerender#1994
CodyJasonBennett merged 2 commits intopmndrs:masterfrom
lukehorvat:StatsGl-classNames-cleanup

Conversation

@lukehorvat
Copy link
Contributor

Why

Both Stats and StatsGl don't remove class names set via the className prop on rerender. In the following example, if showStats is initially false and then later changes to true, the Hidden class does not get removed from the DOM element.

<Stats className={`Stats ${showStats ? '' : 'Hidden'}`} />

What

Fixed by removing the previously added class names during useEffect cleanup.

Checklist

  • Ready to be merged

@vercel
Copy link

vercel bot commented Jun 14, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
drei ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 14, 2024 9:35pm

@codesandbox-ci
Copy link

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

@github-actions
Copy link

🎉 This PR is included in version 9.107.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@lukehorvat lukehorvat deleted the StatsGl-classNames-cleanup branch June 16, 2024 17:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants