Fixed issue with SidebarPanelGroup showing StatusPromotionPanels

• Fixed:
- issue with SidebarPanelGroup showing StatusPromotionPanels
This commit is contained in:
mgabdev 2020-10-06 08:42:53 -05:00
parent 65c5ee56f9
commit 9b044f233a

View File

@ -2,7 +2,7 @@ import React from 'react'
import PropTypes from 'prop-types'
import { me, promotions } from '../initial_state'
import Bundle from '../features/ui/util/bundle'
import WrappedBundle from '../features/ui/util/bundle'
import WrappedBundle from '../features/ui/util/wrapped_bundle'
import {
StatusPromotionPanel
} from '../features/ui/util/async_components'
@ -19,7 +19,7 @@ class SidebarPanelGroup extends React.PureComponent {
if (!!promotion) {
const correctedPosition = promotion.position - 1 > layout.length ? layout.length - 1 : promotion.position
if (!layout.find(p => p.key === 'status-promotion-panel')) {
layout.splice(correctedPosition, 0, <WrappedBundle component={StatusPromotionPanel} componentParams={{ statusId: promotion.status_id }} />)
layout.splice(correctedPosition, 0, <WrappedBundle key='status-promotion-panel' component={StatusPromotionPanel} componentParams={{ statusId: promotion.status_id }} />)
}
}
}
@ -30,7 +30,7 @@ class SidebarPanelGroup extends React.PureComponent {
layout.map((panel) => {
if (!panel) return null
if (typeof panel !== 'function') {
if (typeof panel !== 'function' || panel.key === 'status-promotion-panel') {
return panel
}