mirror of
https://github.com/Unleash/unleash.git
synced 2024-12-22 19:07:54 +01: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,
|
||||
UseFeatureToggleSwitchType,
|
||||
} from './FeatureToggleSwitch.types';
|
||||
import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender';
|
||||
|
||||
type Middleware = (next: () => void) => void;
|
||||
|
||||
@ -212,10 +213,19 @@ export const useFeatureToggleSwitch: UseFeatureToggleSwitchType = (
|
||||
[setProdGuardModalState],
|
||||
);
|
||||
|
||||
const featureSelected = enableEnvironmentDialogState.featureId.length !== 0;
|
||||
|
||||
const modals = (
|
||||
<>
|
||||
<FeatureStrategyProdGuard {...prodGuardModalState} />
|
||||
<EnableEnvironmentDialog {...enableEnvironmentDialogState} />
|
||||
<ConditionallyRender
|
||||
condition={featureSelected}
|
||||
show={
|
||||
<EnableEnvironmentDialog
|
||||
{...enableEnvironmentDialogState}
|
||||
/>
|
||||
}
|
||||
/>
|
||||
<ChangeRequestDialogue
|
||||
isOpen={changeRequestDialogDetails.isOpen}
|
||||
onClose={() => {
|
||||
@ -238,5 +248,8 @@ export const useFeatureToggleSwitch: UseFeatureToggleSwitchType = (
|
||||
</>
|
||||
);
|
||||
|
||||
return { onToggle, modals };
|
||||
return {
|
||||
onToggle,
|
||||
modals,
|
||||
};
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user