Skip to content
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

[manager-components]: useAuthorizationIam is not working as expected #13791

Open
3 tasks done
JacquesLarique opened this issue Oct 25, 2024 · 0 comments
Open
3 tasks done
Assignees
Labels
bug Something isn't working manager-components

Comments

@JacquesLarique
Copy link
Contributor

On which entity, you would like to report a bug?

src/hooks/iam/useOvhIam.tsx

Description

When you pass an undefined string to useAuthorizationIam for urn, a request is still sent with the urn as undefined

This is because the following line will be evaluated as undefined (instead of false):
urn && urn.length > 0 && actions && actions.length > 0 && isTrigger,
And as a result, tanstack consider that enabled isn't given to the useQuery.

A similar issue happens when you pass an empty string (but it will throw an error on tanstack side)

To fix this issue, we should replace the previously mentioned line by this one:
Boolean(urn) && urn.length > 0 && Boolean(actions) && actions.length > 0 && isTrigger
This way it would ensure that if we pass either an empty string or undefined to useAuthorizationIam, the enabled property given to useQuery will always be a boolean

Steps to reproduce

Call useAuthorizationIam with either an empty string or undefined

Browser

No response

Operating System

  • macOS
  • Windows
  • Linux

Additional Information

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working manager-components
Projects
None yet
Development

No branches or pull requests

1 participant