Uncaught TypeError: Невозможно прочитать свойство 'replaceChild' из null
Итак, я использую динамическую маршрутизацию, чтобы заменить один компонент другим. Я сохраняю компонент, ссылку и идентификатор текущего компонента в свойстве исходного состояния редуктора. И тогда, когда ссылка меняется, компонент заменяется. До этого момента все работало нормально. Я получаю ошибку:
Есть ли способ удалить созданную TabPanel из DOM при выполнении componentWillUnmount? Это мой текущий рендер:
<Container ref={ dashboardTabsContainer => this.dashboardTabsContainer = dashboardTabsContainer } layout="fit" padding={10} style={{ 'backgroundColor': 'transparent', 'height': '800px'}}>
<TabPanel
ref = {dashboardTabPanel => self.dashboardTabPanel = dashboardTabPanel}
shadow style={{ "height": "800px", "width": "100%"}}
ui="tabPanelDashboard"
border={false}
activeItem={0}
onActivate={this.onActivationOfTab}
onActiveItemChange={this.onActivationOfTab}
onShow={this.showComponent}
tabBar={{
docked: 'top',
height: 48,
layout: {
pack: 'left'
},
style: {
paddingRight: '52px'
}
}}
>
{dashboardMain.map((item) =>
<Container dashboard = {item} onActivate={this.setCurrentDashboardAndItsId(item)} onActiveItemChange={this.setCurrentDashboardAndItsId(item)} scrollable border={false} title={item.title} tab={{ 'flex': 1, 'maxWidth': 200 }} style={{ 'flex': 1, 'height': '500px' }} >
<PopOverForInsertingPLContainer dashboard = {item} dashboardId = {item.id} />
<DashboardContainer dashboard = {item} dashboardid = {item.id} />
</Container>
)}
{dashboardUsersItems.map((item) =>
<Container dashboard = {item} scrollable onActivate={this.setCurrentDashboardAndItsId(item)} onActiveItemChange={this.setCurrentDashboardAndItsId(item)} border={false} title={item.title} tab={{ 'flex': 1, 'maxWidth': 200 }} style={{ 'flex': 1, 'height': '500px' }} closable onDestroy={() => this.deleteDashboard(item.id)} >
<PopOverForInsertingPLContainer dashboard = {item} dashboardId = {item.id} />
<DashboardContainer dashboard = {item} dashboardid = {item.id} />
</Container>
)}
</TabPanel>
<Button
top={18}
right={20}
iconCls="x-fa fa-plus"
ui="alt round"
tooltip="New Tab"
handler={this.insertDashboardTab}
/>
</Container>