Skip to content

Commit

Permalink
PB-984: more torough check on equality
Browse files Browse the repository at this point in the history
small issue with filtering
  • Loading branch information
ltkum committed Oct 15, 2024
1 parent 2ae7742 commit 629c9b1
Showing 1 changed file with 15 additions and 16 deletions.
31 changes: 15 additions & 16 deletions src/store/modules/ui.store.js
Original file line number Diff line number Diff line change
Expand Up @@ -390,15 +390,13 @@ export default {
commit('setShowDisclaimer', { showDisclaimer, dispatcher })
},
addErrors({ commit, state }, { errors, dispatcher }) {
if (
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].some((otherError) => {
error.isEquals(otherError)
})
if (errors instanceof Array && errors.every((error) => error instanceof ErrorMessage)) {
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 })
Expand All @@ -423,15 +421,16 @@ export default {
addWarnings({ commit, state }, { warnings, dispatcher }) {
if (
warnings instanceof Array &&
warnings.filter((warning) => warning instanceof WarningMessage).length ===
warnings.length
warnings.every((warning) => warning instanceof WarningMessage)
) {
warnings = warnings.filter((warning) =>
// we only add the warnings that are not existing within the store
[...state.warnings].some((otherWarning) => {
warning.isEquals(otherWarning)
})
warnings = warnings.filter(
(warning) =>
// we only add the warnings that are not existing within the store
![...state.warnings].some((otherWarning) => {
warning.isEquals(otherWarning)
})
)
log.error(warnings)
if (warnings.length > 0) {
commit('addWarnings', { warnings, dispatcher })
}
Expand Down

0 comments on commit 629c9b1

Please sign in to comment.