Skip to content

The useAnnotationSelectAction doesn't respect the annotator's adapter #496

@oleksandr-danylchenko

Description

@oleksandr-danylchenko

Issue behavior

See - 79c7b17#r150398933

In the useAnnotationSelectAction hook, when the onUserSelect is called - it doesn't receive the adapter associated with the annotator instance.
However, the UserSelectActionExpression<E> type dictates that the selection action callback will run on the external type annotation instance.

export const useAnnotationSelectAction = <I extends Annotation = ImageAnnotation, E extends unknown = ImageAnnotation>(id: string, action: UserSelectActionExpression<E>) => {
const annotation = useAnnotation<I>(id);
return annotation ? onUserSelect<I, E>(annotation, action) : undefined;
}

That makes the user create the userSelectAction callback that will throw the runtime exception while trying to run the useAnnotationSelectAction.

Screenshots

image
However, in runtime, the userSelectAction will receive an internal type instance:
image

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions