Skip to content

Commit

Permalink
Merge pull request #437 from opendatalab/main
Browse files Browse the repository at this point in the history
fix(frontend): show task config when pre annotation config is none
  • Loading branch information
gary-Shen authored Feb 27, 2024
2 parents db1bc0d + dd93b34 commit f2d1d6a
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions apps/frontend/src/pages/tasks.[id].samples.[id]/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,12 @@ const AnnotationPage = () => {

const isLoading = useMemo(() => loading || isFetching > 0 || isMutating > 0, [loading, isFetching, isMutating]);

const config = useMemo(() => {
return isSampleAnnotationEmpty && !_.isEmpty(preAnnotationConfig)
? preAnnotationConfig
: configFromParent || editorConfig;
}, [configFromParent, editorConfig, isSampleAnnotationEmpty, preAnnotationConfig]);

if (task?.media_type === MediaType.IMAGE) {
content = (
<ImageAnnotator
Expand All @@ -208,7 +214,7 @@ const AnnotationPage = () => {
onError={onError}
offsetTop={configFromParent ? 100 : 156}
editingSample={editingSample}
config={isSampleAnnotationEmpty ? preAnnotationConfig : configFromParent || editorConfig}
config={config}
/>
);
} else if (task?.media_type === MediaType.VIDEO) {
Expand All @@ -218,7 +224,7 @@ const AnnotationPage = () => {
ref={videoAnnotationRef}
offsetTop={configFromParent ? 100 : 156}
editingSample={editingSample}
config={isSampleAnnotationEmpty ? preAnnotationConfig : configFromParent || editorConfig}
config={config}
toolbarRight={topActionContent}
renderSidebar={renderSidebar}
/>
Expand All @@ -230,7 +236,7 @@ const AnnotationPage = () => {
ref={audioAnnotationRef}
offsetTop={configFromParent ? 100 : 156}
editingSample={editingSample}
config={isSampleAnnotationEmpty ? preAnnotationConfig : configFromParent || editorConfig}
config={config}
toolbarRight={topActionContent}
renderSidebar={renderSidebar}
/>
Expand Down

0 comments on commit f2d1d6a

Please sign in to comment.