From f00f045c6f41962b8361e78c8a64ea40b19fa135 Mon Sep 17 00:00:00 2001 From: Johannes Baiter <johannes.baiter@bsb-muenchen.de> Date: Thu, 24 Sep 2020 18:17:02 +0200 Subject: [PATCH] Fix canvas label display in ViewerInfo. The component would always get be passed an `undefined` prop for the label, since the selector in the container used the `canvasIdx` to select the label, but the selector expected the identifier. This was missed in #2851 when the canvas identifier was passed to components that were missing it. Additionally, this commit removes the `canvasLabel` prop from the `WindowCanvasNavigationControls` container, since the label is never used in the actual component. (#3258) --- src/containers/ViewerInfo.js | 7 +++++-- src/containers/WindowCanvasNavigationControls.js | 10 +--------- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/src/containers/ViewerInfo.js b/src/containers/ViewerInfo.js index e63b29722..6aacacb19 100644 --- a/src/containers/ViewerInfo.js +++ b/src/containers/ViewerInfo.js @@ -4,7 +4,9 @@ import { withTranslation } from 'react-i18next'; import { withStyles } from '@material-ui/core/styles'; import { withPlugins } from '../extend/withPlugins'; import { ViewerInfo } from '../components/ViewerInfo'; -import { getCanvasLabel, getCanvases, getCanvasIndex } from '../state/selectors'; +import { + getCanvasLabel, getCanvases, getCanvasIndex, getVisibleCanvasIds +} from '../state/selectors'; /** * mapStateToProps - to hook up connect @@ -15,12 +17,13 @@ const mapStateToProps = (state, props) => { const { windowId } = props; const canvases = getCanvases(state, { windowId }); const canvasIndex = getCanvasIndex(state, { windowId }); + const canvasId = getVisibleCanvasIds(state, { windowId })[0]; return { canvasCount: canvases.length, canvasIndex, canvasLabel: getCanvasLabel(state, { - canvasIndex, + canvasId, windowId, }), }; diff --git a/src/containers/WindowCanvasNavigationControls.js b/src/containers/WindowCanvasNavigationControls.js index 7fc436c92..c82335148 100644 --- a/src/containers/WindowCanvasNavigationControls.js +++ b/src/containers/WindowCanvasNavigationControls.js @@ -4,19 +4,11 @@ import { withSize } from 'react-sizeme'; import { withStyles } from '@material-ui/core'; import { fade } from '@material-ui/core/styles/colorManipulator'; import { withPlugins } from '../extend/withPlugins'; -import { - getCurrentCanvas, - getCanvasLabel, - getWorkspace, -} from '../state/selectors'; +import { getWorkspace } from '../state/selectors'; import { WindowCanvasNavigationControls } from '../components/WindowCanvasNavigationControls'; /** */ const mapStateToProps = (state, { windowId }) => ({ - canvasLabel: getCanvasLabel(state, { - canvasId: (getCurrentCanvas(state, { windowId }) || {}).id, - windowId, - }), visible: getWorkspace(state).focusedWindowId === windowId, }); -- GitLab