From f5111c0f4159dbb4b4eaaa1b0fffc8b75654c997 Mon Sep 17 00:00:00 2001 From: Julien Fontanet Date: Thu, 12 Aug 2021 17:29:57 +0200 Subject: [PATCH] fix(mixins/Config#watch): use deep equality to check changes Because objects (and arrays) will always be new ones and thus different. --- @xen-orchestra/mixins/Config.js | 3 ++- CHANGELOG.unreleased.md | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/@xen-orchestra/mixins/Config.js b/@xen-orchestra/mixins/Config.js index b6f626090..23291d24d 100644 --- a/@xen-orchestra/mixins/Config.js +++ b/@xen-orchestra/mixins/Config.js @@ -1,5 +1,6 @@ const get = require('lodash/get') const identity = require('lodash/identity') +const isEqual = require('lodash/isEqual') const { createLogger } = require('@xen-orchestra/log') const { parseDuration } = require('@vates/parse-duration') const { watch } = require('app-conf') @@ -48,7 +49,7 @@ module.exports = class Config { const watcher = config => { try { const value = processor(get(config, path)) - if (value !== prev) { + if (!isEqual(value, prev)) { prev = value cb(value) } diff --git a/CHANGELOG.unreleased.md b/CHANGELOG.unreleased.md index af056007b..309eade25 100644 --- a/CHANGELOG.unreleased.md +++ b/CHANGELOG.unreleased.md @@ -32,6 +32,7 @@ > In case of conflict, the highest (lowest in previous list) `$version` wins. - @xen-orchestra/log minor +- @xen-orchestra/mixins patch - xo-server-auth-ldap patch - xo-server patch - xo-web minor