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

Commit d4c1f06

Browse files
committed
fix(plugins/plugin-client-common): TabContainer and TabContent double render on startup
part of #7929
1 parent c4bc1e1 commit d4c1f06

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

plugins/plugin-client-common/src/components/Client/TabContainer.tsx

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,20 +43,19 @@ interface State {
4343
/** list of current tabs; one TabContent for each */
4444
tabs: TabModel[]
4545

46-
/** Has the first tab activated itself? */
47-
isFirstTabReady: boolean
48-
4946
/** current active tab index */
5047
activeIdx: number
5148
}
5249

5350
export default class TabContainer extends React.PureComponent<Props, State> {
51+
/** Has the first tab activated itself? */
52+
private isFirstTabReady = false
53+
5454
public constructor(props: Props) {
5555
super(props)
5656

5757
this.state = {
5858
tabs: [this.newTabModel()],
59-
isFirstTabReady: false,
6059
activeIdx: 0
6160
}
6261

@@ -221,11 +220,11 @@ export default class TabContainer extends React.PureComponent<Props, State> {
221220

222221
private onTabReady(tab: Tab) {
223222
// "initial tab" handling
224-
if (!this.state.isFirstTabReady) {
223+
if (!this.isFirstTabReady) {
225224
if (this.props.onTabReady) {
226225
this.props.onTabReady(tab)
227226
}
228-
this.setState({ isFirstTabReady: true })
227+
this.isFirstTabReady = true
229228
}
230229

231230
// then, for all tabs: we were asked to execute a command line in
@@ -283,7 +282,6 @@ export default class TabContainer extends React.PureComponent<Props, State> {
283282
key={_.uuid}
284283
uuid={_.uuid}
285284
active={idx === this.state.activeIdx}
286-
willUpdateTopTabButtons={this.willUpdateTopTabButtons.bind(this, _.uuid)}
287285
onTabReady={this._onTabReady}
288286
state={_.state}
289287
>

plugins/plugin-client-common/src/components/Client/TabContent.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import React from 'react'
1818
import { eventChannelUnsafe, eventBus, Tab as KuiTab, TabState, initializeSession } from '@kui-shell/core'
1919

2020
import KuiContext from './context'
21-
import { TopTabButton } from './TabModel'
2221
const Confirm = React.lazy(() => import('../Views/Confirm'))
2322

2423
import getSize from '../Views/Terminal/getSize'
@@ -48,7 +47,6 @@ type Props = TabContentOptions &
4847
state: TabState
4948
snapshot?: Buffer
5049
tabTitle?: string
51-
willUpdateTopTabButtons?: (buttons: TopTabButton[]) => void
5250
}
5351

5452
type SessionInitStatus = 'NotYet' | 'InProgress' | 'Reinit' | 'Done' | 'Error'

0 commit comments

Comments
 (0)