diff --git a/frontend/src/component/project/Project/PaginatedProjectFeatureToggles/ProjectFeatureTogglesHeader/CreateFeatureDialog.tsx b/frontend/src/component/project/Project/PaginatedProjectFeatureToggles/ProjectFeatureTogglesHeader/CreateFeatureDialog.tsx index bfb33730cce5..a137c49eda5a 100644 --- a/frontend/src/component/project/Project/PaginatedProjectFeatureToggles/ProjectFeatureTogglesHeader/CreateFeatureDialog.tsx +++ b/frontend/src/component/project/Project/PaginatedProjectFeatureToggles/ProjectFeatureTogglesHeader/CreateFeatureDialog.tsx @@ -79,6 +79,17 @@ const configButtonData = { export const CreateFeatureDialog = ({ open, onClose, +}: ICreateFeatureDialogProps) => { + if (open) { + // wrap the inner component so that we only fetch data etc + // when the dialog is actually open. + return ; + } +}; + +const CreateFeatureDialogContent = ({ + open, + onClose, }: ICreateFeatureDialogProps) => { const { setToastData, setToastApiError } = useToast(); const { setShowFeedback } = useContext(UIContext); @@ -158,7 +169,7 @@ export const CreateFeatureDialog = ({ }; const { total: totalFlags, loading: loadingTotalFlagCount } = - useGlobalFeatureSearch(); + useGlobalFeatureSearch(1); const { project: projectInfo } = useProjectOverview(project); const { tags: allTags } = useAllTags();