Skip to content
This repository was archived by the owner on Jul 30, 2025. It is now read-only.

Commit f0fe460

Browse files
committed
fix: linked Commentary does not update until a tab switch
1 parent 2a07e0c commit f0fe460

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

plugins/plugin-client-common/src/components/Content/Commentary.tsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,15 @@ class Commentary extends React.PureComponent<PropsInternal, State> {
8585
}
8686
}
8787

88-
public componentDidUpdate() {
88+
public componentDidUpdate(_, prevState: State) {
8989
if (this.props.send) {
90-
// broadcast new textValue
91-
if (this.props.previousActiveKey !== undefined && this.props.activeKey === this.state.initialActiveKey) {
90+
// broadcast new textValue if either:
91+
// a. different textValue
92+
// b. there has been a tab switch above us (i.e. in a contanining component)
93+
if (
94+
prevState.textValue !== this.state.textValue ||
95+
(this.props.previousActiveKey !== undefined && this.props.activeKey === this.state.initialActiveKey)
96+
) {
9297
Commentary.events.emit(Commentary.editChannel(this.props), this.state.textValue)
9398
}
9499
}

0 commit comments

Comments
 (0)