Skip to content

Commit

Permalink
fix initial mpr hp
Browse files Browse the repository at this point in the history
  • Loading branch information
sedghi committed Sep 13, 2023
1 parent 5bb78a6 commit e15848c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions platform/ui/src/contextProviders/ViewportGridProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@ const determineActiveViewportId = (state: DefaultState, newViewports: Map) => {
const currentActiveViewport = state.viewports.get(activeViewportId);

if (!currentActiveViewport) {
return null; // Return an appropriate value if the current active viewport is not found
// if there is no active viewport, we should just return the first viewport
const firstViewport = newViewports.values().next().value;
return firstViewport.viewportOptions.viewportId;
}

// for the new viewports, we should rank them by the displaySetInstanceUIDs
Expand Down Expand Up @@ -257,7 +259,7 @@ export function ViewportGridProvider({ children, service }) {
}

activeViewportIdToSet =
activeViewportIdToSet ?? determineActiveViewportId(state, viewports) ?? 'default';
activeViewportIdToSet ?? determineActiveViewportId(state, viewports);

const ret = {
...state,
Expand Down

0 comments on commit e15848c

Please sign in to comment.