diff --git a/src/store/modules/ui.store.js b/src/store/modules/ui.store.js index 2a3733e3d..db3d11f71 100644 --- a/src/store/modules/ui.store.js +++ b/src/store/modules/ui.store.js @@ -394,12 +394,11 @@ export default { errors instanceof Array && errors.filter((error) => error instanceof ErrorMessage).length === errors.length ) { - errors = errors.filter( - (error) => - // we only add the errors that are not existing within the store - [...state.errors].filter((otherError) => { - error.isEquals(otherError) - }).length === 0 + errors = errors.filter((error) => + // we only add the errors that are not existing within the store + [...state.errors].some((otherError) => { + error.isEquals(otherError) + }) ) if (errors.length > 0) { commit('addErrors', { errors, dispatcher }) @@ -427,12 +426,11 @@ export default { warnings.filter((warning) => warning instanceof WarningMessage).length === warnings.length ) { - warnings = warnings.filter( - (warning) => - // we only add the warnings that are not existing within the store - [...state.warnings].filter((otherWarning) => { - warning.isEquals(otherWarning) - }).length === 0 + warnings = warnings.filter((warning) => + // we only add the warnings that are not existing within the store + [...state.warnings].some((otherWarning) => { + warning.isEquals(otherWarning) + }) ) if (warnings.length > 0) { commit('addWarnings', { warnings, dispatcher }) diff --git a/src/utils/ErrorMessage.class.js b/src/utils/ErrorMessage.class.js index a82bf9675..7915962c7 100644 --- a/src/utils/ErrorMessage.class.js +++ b/src/utils/ErrorMessage.class.js @@ -6,14 +6,18 @@ export default class ErrorMessage { */ constructor(msg, params = null) { this.msg = msg - this.params = params + this.params = params ?? {} } isEquals(object) { return ( object instanceof ErrorMessage && object.msg === this.msg && - object.params === this.params + Object.keys(this.params).every( + (key) => + Object.keys(object.params).includes(key) && + this.params[key] === object.params[key] + ) ) } } diff --git a/src/utils/WarningMessage.class.js b/src/utils/WarningMessage.class.js index 127aefafd..38a2bcf76 100644 --- a/src/utils/WarningMessage.class.js +++ b/src/utils/WarningMessage.class.js @@ -6,14 +6,18 @@ export default class WarningMessage { */ constructor(msg, params = null) { this.msg = msg - this.params = params + this.params = params ?? {} } isEquals(object) { return ( object instanceof WarningMessage && object.msg === this.msg && - object.params === this.params + Object.keys(this.params).every( + (key) => + Object.keys(object.params).includes(key) && + this.params[key] === object.params[key] + ) ) } }