mirror of
https://github.com/Unleash/unleash.git
synced 2025-01-25 00:07:47 +01:00
fix: strategy edit required param error (#7747)
Fixing error "Missing required path param: featureId", on editing default project strategy.
This commit is contained in:
parent
a918fbb49d
commit
301454838b
@ -15,6 +15,7 @@ import { StickinessSelect } from './StickinessSelect/StickinessSelect';
|
||||
import { useDefaultProjectSettings } from 'hooks/useDefaultProjectSettings';
|
||||
import Loader from '../../../common/Loader/Loader';
|
||||
import { useRequiredPathParam } from 'hooks/useRequiredPathParam';
|
||||
import { useOptionalPathParam } from 'hooks/useOptionalPathParam';
|
||||
import { useLocation } from 'react-router';
|
||||
import type { IFormErrors } from 'hooks/useFormErrors';
|
||||
|
||||
@ -58,7 +59,7 @@ const FlexibleStrategy = ({
|
||||
errors,
|
||||
}: IFlexibleStrategyProps) => {
|
||||
const projectId = useRequiredPathParam('projectId');
|
||||
const featureId = useRequiredPathParam('featureId');
|
||||
const featureId = useOptionalPathParam('featureId');
|
||||
const { defaultStickiness, loading } = useDefaultProjectSettings(projectId);
|
||||
const { pathname } = useLocation();
|
||||
|
||||
@ -83,7 +84,11 @@ const FlexibleStrategy = ({
|
||||
|
||||
const groupId = useMemo(() => {
|
||||
if (!parameters.groupId && !loading) {
|
||||
updateParameter('groupId', isDefaultStrategyEdit ? '' : featureId);
|
||||
if (isDefaultStrategyEdit || !featureId) {
|
||||
updateParameter('groupId', '');
|
||||
} else {
|
||||
updateParameter('groupId', featureId);
|
||||
}
|
||||
}
|
||||
|
||||
return parseParameterString(parameters.groupId);
|
||||
|
Loading…
Reference in New Issue
Block a user