From 0e366fccc36060973a6af9eb9734796648f00a5a Mon Sep 17 00:00:00 2001 From: hanayashiki Date: Sun, 25 Apr 2021 14:19:54 -0700 Subject: [PATCH] fix(devui): Always run updateTabs on UNSAFE_componentWillReceiveProps. Otherwise, the changes in property tabs might not be reflected on the UI. --- packages/devui/src/Tabs/Tabs.tsx | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/packages/devui/src/Tabs/Tabs.tsx b/packages/devui/src/Tabs/Tabs.tsx index 38649751..67ee72cd 100644 --- a/packages/devui/src/Tabs/Tabs.tsx +++ b/packages/devui/src/Tabs/Tabs.tsx @@ -24,10 +24,8 @@ export default class Tabs

extends Component> { SelectedComponent?: React.ComponentType

; selector?: () => P; - UNSAFE_componentWillReceiveProps(nextProps: TabsProps

) { - if (nextProps.selected !== this.props.selected) { - this.updateTabs(nextProps); - } + UNSAFE_componentWillReceiveProps(nextProps: TabsProps

): void { + this.updateTabs(nextProps); } onMouseUp: React.MouseEventHandler = (e) => { @@ -38,7 +36,7 @@ export default class Tabs

extends Component> { this.props.onClick(e.currentTarget.value); }; - updateTabs(props: TabsProps

) { + updateTabs(props: TabsProps

): void { const tabs = props.tabs; const selected = props.selected;