Skip to content

Commit

Permalink
fixing back button for camera asset (ohcnetwork#9246)
Browse files Browse the repository at this point in the history
  • Loading branch information
SwanandBhuskute authored and UdaySagar-Git committed Dec 3, 2024
1 parent e7ac7b7 commit 14e4f39
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/components/CameraFeed/ConfigureCamera.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,16 +89,15 @@ export default function ConfigureCamera(props: Props) {

const firstBedId =
linkedAssetBeds?.[0]?.bed_object.id ?? unlinkedBeds?.[0]?.id;
useEffect(() => {
if (!query.bed && firstBedId) {
setQuery({ bed: firstBedId });
}
}, [query.bed, firstBedId]);

const selectedBedId = query.bed || firstBedId;

const selectedAssetBed = linkedAssetBeds?.find(
(a) => a.bed_object.id === query.bed,
(a) => a.bed_object.id === selectedBedId,
);
const selectedUnlinkedBed = unlinkedBeds?.find(
(bed) => bed.id === selectedBedId,
);
const selectedUnlinkedBed = unlinkedBeds?.find((bed) => bed.id === query.bed);

const cameraPresetsQuery = useQuery(FeedRoutes.listAssetBedPresets, {
pathParams: { assetbed_id: selectedAssetBed?.id ?? "" },
Expand Down

0 comments on commit 14e4f39

Please sign in to comment.