Skip to content

wrong callback signature or bug in onCardDragEnd of UncontrolledBoard #47

Description

@Finkes

The onCardDragEnd event of the UncontrolledBoard returns four parameters even the typescript signature is described as:

export type OnDragEndNotification<TSubject> = (subject: TSubject, source: OnDragEnd<TSubject>["source"], destination: OnDragEnd<TSubject>["destination"]) => void

Expected Arguments
(subject, source, destination)

Actual Arguments
(board, subject, source, destination)

Looking at the code it seems like the reorderedBoard is mistakenly added to the callback as first argument.
If this was intended, then the signature should be fixed by adding the board as first argument.

// @ts-expect-error TS(7031) FIXME: Binding element 'source' implicitly has an 'any' t... Remove this comment to see the full error message
const handleOnDragEnd = ({ source, destination, subject }, { moveCallback, notifyCallback }) => {
const reorderedBoard = moveCallback(board, source, destination)
when(notifyCallback)((callback) => callback(reorderedBoard, subject, source, destination))
setBoard(reorderedBoard)
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions