Skip to content

Fix <Authenticated> briefly renders its children when checkAuth returns error#10443

Merged
fzaninotto merged 1 commit intomarmelab:masterfrom
adrien-may:patch-4
Jan 13, 2025
Merged

Fix <Authenticated> briefly renders its children when checkAuth returns error#10443
fzaninotto merged 1 commit intomarmelab:masterfrom
adrien-may:patch-4

Conversation

@adrien-may
Copy link
Contributor

@adrien-may adrien-may commented Jan 11, 2025

Problem

Using <Authenticated>, we can witness a quick render with the children provided whereas it shouldn't. This happens because react-query returns an object with isPending=False but the callback for error has not been called yet.

Solution

Checking for isError and isPending seems to be more reliable

How To Test

I added a test to demonstrate the problem

Additional Checks

  • The PR targets master for a bugfix, or next for a feature
  • The PR includes unit tests (if not possible, describe why)
  • The PR includes one or several stories (if not possible, describe why)
  • The documentation is up to date

Also, please make sure to read the contributing guidelines.

@fzaninotto fzaninotto changed the title fix <Authenticated> - never render its children when checkAuth return… Fix <Authenticated> briefly renders its children when checkAuth returns error Jan 13, 2025
@fzaninotto fzaninotto merged commit 0577a60 into marmelab:master Jan 13, 2025
13 checks passed
@fzaninotto
Copy link
Member

Thanks a lot for the well-written PR and the patch!

@fzaninotto fzaninotto added this to the 5.4.5 milestone Jan 13, 2025
@adrien-may adrien-may deleted the patch-4 branch January 13, 2025 08:29
@djhi djhi modified the milestones: 5.4.5, 5.5.0 Jan 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants