From 35a116abbbbe8ea1076d16cf3f6ee9b41f67ba4f Mon Sep 17 00:00:00 2001 From: Jonathan Bernard Date: Sun, 16 Feb 2020 21:08:05 -0600 Subject: [PATCH] Fix insert/update logic of the measurements store. --- web/src/store-modules/measurement.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/src/store-modules/measurement.ts b/web/src/store-modules/measurement.ts index 6058e4a..13b9260 100644 --- a/web/src/store-modules/measurement.ts +++ b/web/src/store-modules/measurement.ts @@ -54,7 +54,7 @@ export class MeasurementStoreModule extends VuexModule { const newMeasurements = existing.slice(); const index = findIndex(existing, { id: measurement.id }); - if (index > 0) { newMeasurements.push(measurement); } + if (index < 0) { newMeasurements.push(measurement); } else { newMeasurements[index] = measurement; } this.measurements = assign({}, this.measurements, { [measure.id]: newMeasurements }); }