1
0
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:
Tymoteusz Czech 2024-08-03 10:03:10 +02:00 committed by GitHub
parent a918fbb49d
commit 301454838b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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);