Skip to content

Commit

Permalink
fix: changed to a some-check instead of a map
Browse files Browse the repository at this point in the history
  • Loading branch information
malmen237 committed Sep 4, 2024
1 parent 11ae7f8 commit b1b3e79
Showing 1 changed file with 7 additions and 27 deletions.
34 changes: 7 additions & 27 deletions src/app/production/[id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,6 @@ export default function ProductionConfiguration({ params }: PageProps) {
putProduction(updatedSetup._id.toString(), updatedSetup);
const pipeline = updatedSetup.production_settings.pipelines[0];

// ! What is the consequence of this? Cannot see the effect ->
pipeline.multiview?.map((singleMultiview) => {
if (
pipeline.pipeline_id &&
Expand All @@ -273,15 +272,6 @@ export default function ProductionConfiguration({ params }: PageProps) {
);
}
});

// if (
// pipeline.pipeline_id &&
// pipeline.multiview &&
// pipeline.multiview.multiview_id
// ) {
// updateMultiviewViews(pipeline.pipeline_id, updatedSetup, source);
// }
// ! <-
};

const updateConfigName = (nameChange: string) => {
Expand Down Expand Up @@ -437,16 +427,13 @@ export default function ProductionConfiguration({ params }: PageProps) {
productionSetup &&
productionSetup.isActive &&
selectedSource &&
// ! What is the consequence of this? Cannot see the effect ->
(Array.isArray(
productionSetup?.production_settings.pipelines[0].multiview
)
? productionSetup.production_settings.pipelines[0].multiview.some(
(singleMultiview) => singleMultiview?.layout?.views
)
: false)
// productionSetup.production_settings.pipelines[0].multiview?.layout.views
// ! <-
) {
const firstEmptySlot = getFirstEmptySlot();
const result = await createStream(
Expand Down Expand Up @@ -498,23 +485,16 @@ export default function ProductionConfiguration({ params }: PageProps) {
selectedSourceRef &&
selectedSourceRef.stream_uuids
) {
const multiview =
const multiviews =
productionSetup.production_settings.pipelines[0].multiview;

if (!multiview) return;
if (!multiviews || multiviews.length === 0) return;

// ! What is the consequence of this? Cannot see the effect ->
// const viewToUpdate = multiview?.layout.views.find(
// (v) => v.input_slot === selectedSourceRef.input_slot
// );
const viewToUpdate = multiview
? multiview.map((item) => {
item.layout.views.find(
(v) => v.input_slot === selectedSourceRef.input_slot
);
})
: false;
// ! <-
const viewToUpdate = multiviews.some((multiview) =>
multiview.layout.views.find(
(v) => v.input_slot === selectedSourceRef.input_slot
)
);

if (!viewToUpdate) {
if (!productionSetup.production_settings.pipelines[0].pipeline_id)
Expand Down

0 comments on commit b1b3e79

Please sign in to comment.