mirror of
https://github.com/Unleash/unleash.git
synced 2025-02-04 00:18:01 +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 { useDefaultProjectSettings } from 'hooks/useDefaultProjectSettings';
|
||||||
import Loader from '../../../common/Loader/Loader';
|
import Loader from '../../../common/Loader/Loader';
|
||||||
import { useRequiredPathParam } from 'hooks/useRequiredPathParam';
|
import { useRequiredPathParam } from 'hooks/useRequiredPathParam';
|
||||||
|
import { useOptionalPathParam } from 'hooks/useOptionalPathParam';
|
||||||
import { useLocation } from 'react-router';
|
import { useLocation } from 'react-router';
|
||||||
import type { IFormErrors } from 'hooks/useFormErrors';
|
import type { IFormErrors } from 'hooks/useFormErrors';
|
||||||
|
|
||||||
@ -58,7 +59,7 @@ const FlexibleStrategy = ({
|
|||||||
errors,
|
errors,
|
||||||
}: IFlexibleStrategyProps) => {
|
}: IFlexibleStrategyProps) => {
|
||||||
const projectId = useRequiredPathParam('projectId');
|
const projectId = useRequiredPathParam('projectId');
|
||||||
const featureId = useRequiredPathParam('featureId');
|
const featureId = useOptionalPathParam('featureId');
|
||||||
const { defaultStickiness, loading } = useDefaultProjectSettings(projectId);
|
const { defaultStickiness, loading } = useDefaultProjectSettings(projectId);
|
||||||
const { pathname } = useLocation();
|
const { pathname } = useLocation();
|
||||||
|
|
||||||
@ -83,7 +84,11 @@ const FlexibleStrategy = ({
|
|||||||
|
|
||||||
const groupId = useMemo(() => {
|
const groupId = useMemo(() => {
|
||||||
if (!parameters.groupId && !loading) {
|
if (!parameters.groupId && !loading) {
|
||||||
updateParameter('groupId', isDefaultStrategyEdit ? '' : featureId);
|
if (isDefaultStrategyEdit || !featureId) {
|
||||||
|
updateParameter('groupId', '');
|
||||||
|
} else {
|
||||||
|
updateParameter('groupId', featureId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return parseParameterString(parameters.groupId);
|
return parseParameterString(parameters.groupId);
|
||||||
|
Loading…
Reference in New Issue
Block a user