From c3b5c51da75e181c70f9676e88661b6caada0649 Mon Sep 17 00:00:00 2001 From: Maciej Ziarkowski Date: Tue, 3 Dec 2019 17:29:08 +0000 Subject: [PATCH] Deep compare array fields --- app/src/api/services/building.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/src/api/services/building.ts b/app/src/api/services/building.ts index 03809cbb..3992a6ee 100644 --- a/app/src/api/services/building.ts +++ b/app/src/api/services/building.ts @@ -2,6 +2,7 @@ * Building data access * */ +import * as _ from 'lodash'; import { ITask } from 'pg-promise'; import db from '../../db'; @@ -423,7 +424,7 @@ function compare(oldObj: object, newObj: object): [object, object] { const reverse = {}; const forward = {}; for (const [key, value] of Object.entries(newObj)) { - if (oldObj[key] != value) { + if (!_.isEqual(oldObj[key], value)) { reverse[key] = oldObj[key]; forward[key] = value; }