Skip to content

Commit ed275ef

Browse files
authored
fix: prevent unecessary api call to get group data when no the bin id is the same as the group id in all media (#2037)
1 parent 81afb2c commit ed275ef

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/apps/media/src/app/components/DnDProvider.tsx

+3-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@ export const DnDProvider = ({
3434
}: Props) => {
3535
const dispatch = useDispatch();
3636
const { data: currentGroup, isFetching: groupIsFetching } =
37-
useGetGroupDataQuery(currentGroupId, { skip: !currentGroupId });
37+
useGetGroupDataQuery(currentGroupId, {
38+
skip: !currentGroupId || currentGroupId === currentBinId,
39+
});
3840
const { data: binData, isFetching: binIsFetching } = useGetBinQuery(
3941
currentBinId,
4042
{ skip: !currentBinId }

src/apps/media/src/app/components/UploadButton.tsx

+3-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ export const UploadButton: FC<UploadButton> = ({
3030
const [params] = useParams();
3131
const triggerUpload = (params as URLSearchParams).get("triggerUpload");
3232
const { data: currentGroup, isFetching: groupIsFetching } =
33-
useGetGroupDataQuery(currentGroupId, { skip: !currentGroupId });
33+
useGetGroupDataQuery(currentGroupId, {
34+
skip: !currentGroupId || currentGroupId === currentBinId,
35+
});
3436
const { data: binData, isFetching: binIsFetching } = useGetBinQuery(
3537
currentBinId,
3638
{ skip: !currentBinId }

0 commit comments

Comments
 (0)