fix(mixins/Config#watch): use deep equality to check changes

Because objects (and arrays) will always be new ones and thus different.
This commit is contained in:
Julien Fontanet 2021-08-12 17:29:57 +02:00
parent f5473236d0
commit f5111c0f41
2 changed files with 3 additions and 1 deletions

View File

@ -1,5 +1,6 @@
const get = require('lodash/get') const get = require('lodash/get')
const identity = require('lodash/identity') const identity = require('lodash/identity')
const isEqual = require('lodash/isEqual')
const { createLogger } = require('@xen-orchestra/log') const { createLogger } = require('@xen-orchestra/log')
const { parseDuration } = require('@vates/parse-duration') const { parseDuration } = require('@vates/parse-duration')
const { watch } = require('app-conf') const { watch } = require('app-conf')
@ -48,7 +49,7 @@ module.exports = class Config {
const watcher = config => { const watcher = config => {
try { try {
const value = processor(get(config, path)) const value = processor(get(config, path))
if (value !== prev) { if (!isEqual(value, prev)) {
prev = value prev = value
cb(value) cb(value)
} }

View File

@ -32,6 +32,7 @@
> In case of conflict, the highest (lowest in previous list) `$version` wins. > In case of conflict, the highest (lowest in previous list) `$version` wins.
- @xen-orchestra/log minor - @xen-orchestra/log minor
- @xen-orchestra/mixins patch
- xo-server-auth-ldap patch - xo-server-auth-ldap patch
- xo-server patch - xo-server patch
- xo-web minor - xo-web minor