Skip to content

Commit d21ebbb

Browse files
benjaminpkanelanzhenwtom-vx51
authored
Merge release/v1.13.3 to develop (#7104)
* fix the schema manager not checking media type for group slices * move attempt recording to in-flight request --------- Co-authored-by: lanzhenw <lanzhenwang9@gmail.com> Co-authored-by: Tom Schmidt <tom.schmidt@voxel51.com> Co-authored-by: Lanny W <lanzhen@voxel51.com>
2 parents 3b9e1bd + 1800bf4 commit d21ebbb

File tree

2 files changed

+19
-5
lines changed

2 files changed

+19
-5
lines changed

app/packages/annotation/src/hooks/useRegisterAnnotationEventHandlers.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,15 @@ export const useRegisterAnnotationEventHandlers = () => {
2424
useCallback(async () => {
2525
if (retryController.canAttempt) {
2626
await handlePersistenceRequest();
27-
retryController.recordAttempt();
2827
}
29-
}, [handlePersistenceRequest, retryController])
28+
}, [handlePersistenceRequest, retryController.canAttempt])
3029
);
3130

3231
useAnnotationEventHandler(
3332
"annotation:persistenceInFlight",
3433
useCallback(() => {
34+
retryController.recordAttempt();
35+
3536
// silence notifications when unhealthy
3637
if (!retryController.isUnhealthy) {
3738
setConfig({
@@ -41,7 +42,7 @@ export const useRegisterAnnotationEventHandlers = () => {
4142
timeout: INDEFINITE_TOAST_TIMEOUT,
4243
});
4344
}
44-
}, [retryController.isUnhealthy, setConfig])
45+
}, [retryController, setConfig])
4546
);
4647

4748
useAnnotationEventHandler(

app/packages/core/src/components/Modal/Sidebar/Annotate/SchemaManager/hooks.ts

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,12 @@
55
import { useOperatorExecutor } from "@fiftyone/operators";
66
import {
77
datasetSampleCount,
8+
groupMediaTypesMap,
9+
isGroup,
810
mediaType,
911
queryPerformanceMaxSearch,
1012
useNotification,
13+
usePreferredGroupAnnotationSlice,
1114
} from "@fiftyone/state";
1215
import { useAtom, useAtomValue, useSetAtom } from "jotai";
1316
import { useAtomCallback } from "jotai/utils";
@@ -623,10 +626,20 @@ export const useExitNewFieldMode = () => {
623626
// =============================================================================
624627

625628
/**
626-
* Hook to get the current dataset media type
629+
* Hook to get the effective media type.
630+
* For group datasets, resolves to the preferred annotation slice's media type.
627631
*/
628632
export const useMediaType = () => {
629-
return useRecoilValue(mediaType);
633+
const datasetMediaType = useRecoilValue(mediaType);
634+
const isGroupDataset = useRecoilValue(isGroup);
635+
const sliceMediaTypesMap = useRecoilValue(groupMediaTypesMap);
636+
const [preferredSlice] = usePreferredGroupAnnotationSlice();
637+
638+
if (isGroupDataset && preferredSlice && sliceMediaTypesMap[preferredSlice]) {
639+
return sliceMediaTypesMap[preferredSlice];
640+
}
641+
642+
return datasetMediaType;
630643
};
631644

632645
/**

0 commit comments

Comments
 (0)