-
Notifications
You must be signed in to change notification settings - Fork 10
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
fix(Buttons): avoid warnings related to change in order of react hooks #1229
Conversation
})} | ||
</Box> | ||
) : null} | ||
{loadingText ? <Box paddingLeft={8}>{loadingButtonElement}</Box> : null} |
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.
This line was causing the issue that I explain in the PR description
Size stats
|
Accessibility report ℹ️ You can run this locally by executing |
Deploy preview for mistica-web ready! ✅ Preview Built with commit e0966f5. |
# [15.19.0](v15.18.0...v15.19.0) (2024-09-03) ### Bug Fixes * **Buttons:** avoid warnings related to change in order of react hooks ([#1229](#1229)) ([2dbc411](2dbc411)) * **i18n): Revert "feat(i18n:** improve texts sizes" because it is breaking ([#1226](#1226)) ([79eb4a4](79eb4a4)) * **Logo:** fix webpackChunkName magic comments ([#1214](#1214)) ([3d1f098](3d1f098)) * **Vivinho char:** vivinho char in headings being read as a separated heading ([#1209](#1209)) ([f0f5fb0](f0f5fb0)) ### Features * **Buttons:** refactor code and fix spacing bug in loading buttonLink ([#1212](#1212)) ([640e429](640e429)) * **i18n:** improve texts sizes ([#1204](#1204)) ([0345e7c](0345e7c)) * **Logo:** Refactor logo to improve bundle size and loading times ([#1210](#1210)) ([15b77cb](15b77cb)) * **NavigationBar, FunnelNavigationBar, MainNavigationBar:** add alternative variant ([#1200](#1200)) ([eef87ec](eef87ec))
🎉 This PR is included in version 15.19.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
If
loadingText
was empty and then it's changed to a non-empty string, the browser will complain because of a change in the order of hooks.This happens because the
TextContentRenderer
function callsuseTheme()
. The issue is that one of the calls toTextContentRenderer
was conditional: it was called only whenloadingText
is truthy. This causes the hook to be called more times ifloadingText
was falsy and suddenly changes to a truthy value.This issue was causing one of the unit tests from webapp to fail. After applying this fix, all of them pass: