ApryseSDK / webviewer-ui

WebViewer UI built in React
Other
409 stars 353 forks source link

[Bug] instance.UI.setActiveLeftPanel not working in modular UI #1069

Open Olliwehr opened 4 months ago

Olliwehr commented 4 months ago

When calling instance.UI.setActiveLeftPanel in combination with the modular UI, I encountered some strange behaviour.

WebViewer version

The current behavior There are no changes in regard to the active panel, not just when calling it with "thumbnailsPanel" but any other (valid) panel of yours.

Also, the browser console shows the following warning:

image

The expected behavior

Steps to reproduce Call instance.UI.setActiveLeftPanel("thumbnailsPanel") and take a look at the browser console

Solution Idea I had a look at the code (./src/helpers/isDataElementLeftPanel.js) and noticed that it would probably only require the following change:

  if (customizableUI) {
    return state.viewer.genericPanels
      .filter((item) => item.location === PLACEMENT.LEFT)
      .map((item) => item.dataElement);
  }

instead of

  if (customizableUI) {
    return state.viewer.genericPanels.filter((item) => item.location === PLACEMENT.LEFT);
  }

as you filter for inclusion of concrete data-elements afterwards.

bollain commented 3 months ago

Hi @Olliwehr!

Thanks for submitting this issue with a corresponding PR. We have a ticket in our backlog to fix this; with the new modular UI the tab panel can live either on the left side, or the right side, so we are creating a new API specific to the new abstraction of the modular Tab Panel.

We will also review your solution in the open PR, as it may provide a stop-gap solution while we roll out the new API. I'll update this ticket when we have a closer look.

Thanks for submitting this and testing out the new modular UI!