🚑 fix: Prevent Infinite Re-Rendering of the Password Reset UI (#2887)

* 🔧 fix: prevent unnecessary re-rendering of components using useLocalize hook

The useLocalize hook now uses useCallback to create a memoized version of the localize function. This will prevent unnecessary recalculations when the language value changes.

* 🚑 fix: not reset the bodyText if it has a value set.
This commit is contained in:
Yuichi Oneda 2024-05-28 11:07:08 -07:00 committed by GitHub
parent 5dc5d875ba
commit 0ee060d730
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 12 additions and 1 deletions

View file

@ -36,6 +36,9 @@ function RequestPasswordReset() {
};
useEffect(() => {
if (bodyText) {
return;
}
if (!requestPasswordReset.isSuccess) {
setHeaderText('com_auth_reset_password');
setBodyText(undefined);
@ -64,6 +67,7 @@ function RequestPasswordReset() {
resetLink,
localize,
setHeaderText,
bodyText,
]);
if (bodyText) {