mirror of
https://github.com/Unleash/unleash.git
synced 2025-03-09 00:18:26 +01:00
refactor(1-3429): makes the drag args optional, defaulting to noops (#9394)
Removes the `() => {} as any` args from the StrategyDraggableItem
invocation when you have paginated strats. Instead makes all the drag
params optional. It defaults to a no op if not provided.
Also, the reason it had to be typed as `any` before is probably because
it was missing a function. The correct empty param is `() => () => {}` 💁
This commit is contained in:
parent
88c3f50073
commit
0a0d6e9e2a
@ -298,12 +298,6 @@ export const EnvironmentAccordionBody = ({
|
|||||||
otherEnvironments={
|
otherEnvironments={
|
||||||
otherEnvironments
|
otherEnvironments
|
||||||
}
|
}
|
||||||
isDragging={false}
|
|
||||||
onDragStartRef={
|
|
||||||
(() => {}) as any
|
|
||||||
}
|
|
||||||
onDragOver={(() => {}) as any}
|
|
||||||
onDragEnd={(() => {}) as any}
|
|
||||||
/>
|
/>
|
||||||
</StyledListItem>
|
</StyledListItem>
|
||||||
))}
|
))}
|
||||||
|
@ -23,26 +23,28 @@ interface IStrategyDraggableItemProps {
|
|||||||
index: number;
|
index: number;
|
||||||
otherEnvironments?: IFeatureEnvironment['name'][];
|
otherEnvironments?: IFeatureEnvironment['name'][];
|
||||||
isDragging?: boolean;
|
isDragging?: boolean;
|
||||||
onDragStartRef: (
|
onDragStartRef?: (
|
||||||
ref: RefObject<HTMLDivElement>,
|
ref: RefObject<HTMLDivElement>,
|
||||||
index: number,
|
index: number,
|
||||||
) => DragEventHandler<HTMLButtonElement>;
|
) => DragEventHandler<HTMLButtonElement>;
|
||||||
onDragOver: (
|
onDragOver?: (
|
||||||
ref: RefObject<HTMLDivElement>,
|
ref: RefObject<HTMLDivElement>,
|
||||||
index: number,
|
index: number,
|
||||||
) => DragEventHandler<HTMLDivElement>;
|
) => DragEventHandler<HTMLDivElement>;
|
||||||
onDragEnd: () => void;
|
onDragEnd?: () => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const onDragNoOp = () => () => {};
|
||||||
|
|
||||||
export const StrategyDraggableItem = ({
|
export const StrategyDraggableItem = ({
|
||||||
strategy,
|
strategy,
|
||||||
index,
|
index,
|
||||||
environmentName,
|
environmentName,
|
||||||
otherEnvironments,
|
otherEnvironments,
|
||||||
isDragging,
|
isDragging,
|
||||||
onDragStartRef,
|
onDragStartRef = onDragNoOp,
|
||||||
onDragOver,
|
onDragOver = onDragNoOp,
|
||||||
onDragEnd,
|
onDragEnd = onDragNoOp,
|
||||||
}: IStrategyDraggableItemProps) => {
|
}: IStrategyDraggableItemProps) => {
|
||||||
const projectId = useRequiredPathParam('projectId');
|
const projectId = useRequiredPathParam('projectId');
|
||||||
const featureId = useRequiredPathParam('featureId');
|
const featureId = useRequiredPathParam('featureId');
|
||||||
|
Loading…
Reference in New Issue
Block a user