mirror of
https://github.com/Unleash/unleash.git
synced 2025-04-06 01:15:28 +02:00
fix: remove extra call to features on project load (#5690)
Currently EnableEnvironmentDialog was loaded even if no feature was touched. Now it will only load, if feature toggle was selected.
This commit is contained in:
parent
dce91b0e90
commit
c979e687ca
@ -14,6 +14,7 @@ import {
|
|||||||
OnFeatureToggleSwitchArgs,
|
OnFeatureToggleSwitchArgs,
|
||||||
UseFeatureToggleSwitchType,
|
UseFeatureToggleSwitchType,
|
||||||
} from './FeatureToggleSwitch.types';
|
} from './FeatureToggleSwitch.types';
|
||||||
|
import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender';
|
||||||
|
|
||||||
type Middleware = (next: () => void) => void;
|
type Middleware = (next: () => void) => void;
|
||||||
|
|
||||||
@ -212,10 +213,19 @@ export const useFeatureToggleSwitch: UseFeatureToggleSwitchType = (
|
|||||||
[setProdGuardModalState],
|
[setProdGuardModalState],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const featureSelected = enableEnvironmentDialogState.featureId.length !== 0;
|
||||||
|
|
||||||
const modals = (
|
const modals = (
|
||||||
<>
|
<>
|
||||||
<FeatureStrategyProdGuard {...prodGuardModalState} />
|
<FeatureStrategyProdGuard {...prodGuardModalState} />
|
||||||
<EnableEnvironmentDialog {...enableEnvironmentDialogState} />
|
<ConditionallyRender
|
||||||
|
condition={featureSelected}
|
||||||
|
show={
|
||||||
|
<EnableEnvironmentDialog
|
||||||
|
{...enableEnvironmentDialogState}
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
/>
|
||||||
<ChangeRequestDialogue
|
<ChangeRequestDialogue
|
||||||
isOpen={changeRequestDialogDetails.isOpen}
|
isOpen={changeRequestDialogDetails.isOpen}
|
||||||
onClose={() => {
|
onClose={() => {
|
||||||
@ -238,5 +248,8 @@ export const useFeatureToggleSwitch: UseFeatureToggleSwitchType = (
|
|||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|
||||||
return { onToggle, modals };
|
return {
|
||||||
|
onToggle,
|
||||||
|
modals,
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user