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
|
||||
}
|
||||
isDragging={false}
|
||||
onDragStartRef={
|
||||
(() => {}) as any
|
||||
}
|
||||
onDragOver={(() => {}) as any}
|
||||
onDragEnd={(() => {}) as any}
|
||||
/>
|
||||
</StyledListItem>
|
||||
))}
|
||||
|
@ -23,26 +23,28 @@ interface IStrategyDraggableItemProps {
|
||||
index: number;
|
||||
otherEnvironments?: IFeatureEnvironment['name'][];
|
||||
isDragging?: boolean;
|
||||
onDragStartRef: (
|
||||
onDragStartRef?: (
|
||||
ref: RefObject<HTMLDivElement>,
|
||||
index: number,
|
||||
) => DragEventHandler<HTMLButtonElement>;
|
||||
onDragOver: (
|
||||
onDragOver?: (
|
||||
ref: RefObject<HTMLDivElement>,
|
||||
index: number,
|
||||
) => DragEventHandler<HTMLDivElement>;
|
||||
onDragEnd: () => void;
|
||||
onDragEnd?: () => void;
|
||||
}
|
||||
|
||||
const onDragNoOp = () => () => {};
|
||||
|
||||
export const StrategyDraggableItem = ({
|
||||
strategy,
|
||||
index,
|
||||
environmentName,
|
||||
otherEnvironments,
|
||||
isDragging,
|
||||
onDragStartRef,
|
||||
onDragOver,
|
||||
onDragEnd,
|
||||
onDragStartRef = onDragNoOp,
|
||||
onDragOver = onDragNoOp,
|
||||
onDragEnd = onDragNoOp,
|
||||
}: IStrategyDraggableItemProps) => {
|
||||
const projectId = useRequiredPathParam('projectId');
|
||||
const featureId = useRequiredPathParam('featureId');
|
||||
|
Loading…
Reference in New Issue
Block a user