Skip to content

Commit

Permalink
allow load button to reload data #209
Browse files Browse the repository at this point in the history
  • Loading branch information
io53 committed Aug 7, 2024
1 parent dc9e6c3 commit 76b919b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/components/CompareView.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ function CompareView(props) {
setLoading(false);
props.isLoading(false);
})();
}, [sensors, props.from, props.dataKey]);
}, [sensors, props.from, props.dataKey, props.reloadIndex]);

const { width } = useContainerDimensions(ref)
const colorMode = useColorMode().colorMode;
Expand Down
5 changes: 4 additions & 1 deletion src/states/SensorCompare.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ import { getUnitHelper } from "../UnitHelper";

let data = {};
const descriptionStyle = { fontFamily: "mulish", fontSize: "14px", fontWeight: 400, maxWidth: "800px" }
let reloadIndex = 0;

function SensorCompare(props) {
const [sensors, setSensors] = useState([])
const [selectedSensors, setSelectedSensors] = useState([])
Expand Down Expand Up @@ -97,7 +99,8 @@ function SensorCompare(props) {
const loadButton = <Button isDisabled={!selectedSensors.length || loading} onClick={() => load()}>{i18next.t("load")}</Button>

const load = () => {
setViewData({ sensors: selectedSensors, from, to, dataKey })
reloadIndex++
setViewData({ sensors: selectedSensors, from, to, dataKey, reloadIndex })
setLoadedDataKeys(dataKey)
}

Expand Down

0 comments on commit 76b919b

Please sign in to comment.