sets event source stream on component mount
fix
when the ui's defaults and the api's defaults are the same the update
fn (which creates the stream) does not get called
@@ -12,12 +12,19 @@ export default class Overview extends Component {
this.state = { contents: null }
}
- async componentDidUpdate ({
- path: previousPath,
- namespace: previousNamespace
- }) {
+ componentDidMount () {
+ const { path, namespace } = this.props
+ this.setEventSourceStream(path, namespace)
+ }
+
+ componentDidUpdate ({ path: previousPath, namespace: previousNamespace }) {
const { path, namespace } = this.props
if (path !== previousPath || namespace !== previousNamespace) {
+ this.setEventSourceStream(path, namespace)
+ }
+ }
+
+ setEventSourceStream (path, namespace) {
// clear state and this.source on change
if (this.source) {
this.source.close()
@@ -47,7 +54,6 @@ export default class Overview extends Component {
this.source = null
})
}
- }
render () {
const { title, isLoading, hasError } = this.props
