diff --git a/ui/src/Components/NavBar/FetchIndicator/index.js b/ui/src/Components/NavBar/FetchIndicator/index.js index 1a684aefc..57d8dc8a8 100644 --- a/ui/src/Components/NavBar/FetchIndicator/index.js +++ b/ui/src/Components/NavBar/FetchIndicator/index.js @@ -1,7 +1,7 @@ -import React, { Component } from "react"; +import React from "react"; import PropTypes from "prop-types"; -import { observer } from "mobx-react"; +import { useObserver } from "mobx-react"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { faCircleNotch } from "@fortawesome/free-solid-svg-icons/faCircleNotch"; @@ -30,34 +30,27 @@ FetchIcon.defaultProps = { spin: false, }; -const FetchIndicator = observer( - class FetchIndicator extends Component { - static propTypes = { - alertStore: PropTypes.instanceOf(AlertStore).isRequired, - }; - - render() { - const { alertStore } = this.props; - - if (alertStore.status.paused) return ; - - const status = alertStore.status.value.toString(); - - if (status === AlertStoreStatuses.Fetching.toString()) - return ( - - ); - - if (status === AlertStoreStatuses.Processing.toString()) - return ; - - return ; - } - } -); +const FetchIndicator = ({ alertStore }) => { + return useObserver(() => + alertStore.status.paused ? ( + + ) : alertStore.status.value.toString() === + AlertStoreStatuses.Fetching.toString() ? ( + + ) : alertStore.status.value.toString() === + AlertStoreStatuses.Processing.toString() ? ( + + ) : ( + + ) + ); +}; +FetchIndicator.propTypes = { + alertStore: PropTypes.instanceOf(AlertStore).isRequired, +}; export { FetchIndicator };