Skip to content

Commit

Permalink
fixed issue where compare page would not render all data #460
Browse files Browse the repository at this point in the history
  • Loading branch information
io53 committed Dec 4, 2024
1 parent 712b94b commit f39d1a9
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/components/CompareView.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -140,14 +140,16 @@ function CompareView(props) {
props.isLoading(true)
setSensorData([])
gdata = []
let pd = [[], []];

for (const sensor of sensors) {
let until = props.to
let since = props.from;
let allData = null;
let stop = false
for (; ;) {
if (since >= until) break;
if (since >= until || stop) {
break;
}
let data = await new NetworkApi().getAsync(sensor, since, until, { limit: pjson.settings.dataFetchPaginationSize });
if (data.result === "success") {
if (!allData) allData = data;
Expand All @@ -157,7 +159,7 @@ function CompareView(props) {
if (data.data.nextUp) until = data.data.nextUp;
else if (data.data.fromCache) until = data.data.measurements[data.data.measurements.length - 1].timestamp;
else if (returndDataLength >= pjson.settings.dataFetchPaginationSize) until = data.data.measurements[data.data.measurements.length - 1].timestamp;
else break;
else stop = true

let d = parse(allData.data);
setSensorData((s) => {
Expand Down

0 comments on commit f39d1a9

Please sign in to comment.