Skip to content

Commit 29e689f

Browse files
committed
fix: clear selection when changing context
1 parent f8f62e8 commit 29e689f

File tree

1 file changed

+7
-1
lines changed
  • plugins/plugin-codeflare-dashboard/src/components/Top

1 file changed

+7
-1
lines changed

Diff for: plugins/plugin-codeflare-dashboard/src/components/Top/index.tsx

+7-1
Original file line numberDiff line numberDiff line change
@@ -82,13 +82,18 @@ class Top extends React.PureComponent<Props, State> {
8282
return ((n % d) + d) % d
8383
}
8484

85+
/** Indicates the absence of a job selection */
86+
private get NO_SELECTION() {
87+
return -1
88+
}
89+
8590
/** Do we have a selected group? */
8691
private get hasSelection() {
8792
return this.state?.selectedGroupIdx >= 0 && this.state?.selectedGroupIdx < this.state.groups.length
8893
}
8994

9095
private clearCurrentJobSelection() {
91-
this.setState({ selectedGroupIdx: -1 })
96+
this.setState({ selectedGroupIdx: this.NO_SELECTION })
9297
}
9398

9499
/** Current cluster context */
@@ -208,6 +213,7 @@ class Top extends React.PureComponent<Props, State> {
208213
this.setState({
209214
groups: [],
210215
updateError: null,
216+
selectedGroupIdx: this.NO_SELECTION,
211217
watcher: await this.props.initWatcher(context, this.onData),
212218
rawModel: Object.assign({ hosts: [], stats: this.emptyStats }, context),
213219
})

0 commit comments

Comments
 (0)