Skip to content

Commit

Permalink
[mod,fix] passes default category kind if no selected category
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrea-Papaleo committed Jun 27, 2024
1 parent 2eb6af5 commit aba95b9
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/hooks/useAnnotationState/useAnnotationState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,8 @@ export const useAnnotationState = (annotationTool: AnnotationTool) => {

const onAnnotated = useMemo(() => {
const func = () => {
dispatch(
annotatorSlice.actions.setAnnotationState({
annotationState: AnnotationState.Annotated,
kind: selectedCategory?.kind,
annotationTool,
})
);
if (selectionMode !== AnnotationMode.New) return;

if (!selectedCategory) {
if (!defaultSelectedCategory) return;
dispatch(
Expand All @@ -66,6 +60,14 @@ export const useAnnotationState = (annotationTool: AnnotationTool) => {
activeImageId!
);
}

dispatch(
annotatorSlice.actions.setAnnotationState({
annotationState: AnnotationState.Annotated,
kind: selectedCategory?.kind ?? defaultSelectedCategory?.kind,
annotationTool,
})
);
};
return func;
}, [
Expand Down

0 comments on commit aba95b9

Please sign in to comment.