1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-12-22 19:07:54 +01:00

fix: move useUiFlag before "return null" to avoid rendering more hooks on the first render (#5258)

Move the hook to before the first return to avoid React erroring out.
This commit is contained in:
Thomas Heartman 2023-11-03 11:04:03 +01:00 committed by GitHub
parent fe61947435
commit 7cf998c509
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -86,12 +86,12 @@ export const ChangeRequestOverview: FC = () => {
const { isChangeRequestConfiguredForReview } =
useChangeRequestsEnabled(projectId);
const scheduleChangeRequests = useUiFlag('scheduledConfigurationChanges');
if (!changeRequest) {
return null;
}
const scheduleChangeRequests = useUiFlag('scheduledConfigurationChanges');
const allowChangeRequestActions = isChangeRequestConfiguredForReview(
changeRequest.environment,
);