diff --git a/client/web/compose/src/components/PageBlocks/Shared/AutomationButtons.vue b/client/web/compose/src/components/PageBlocks/Shared/AutomationButtons.vue index 5b94d3b58..388cdcb25 100644 --- a/client/web/compose/src/components/PageBlocks/Shared/AutomationButtons.vue +++ b/client/web/compose/src/components/PageBlocks/Shared/AutomationButtons.vue @@ -145,11 +145,6 @@ export default { stepID, input, }) - .then(() => { - setTimeout(() => { - this.$store.dispatch('wfPrompts/update') - }, 500) - }) .catch(this.toastErrorHandler(this.$t('notification:automation.scriptFailed'))) .finally(() => { this.processing = false diff --git a/client/web/compose/src/mixins/record.js b/client/web/compose/src/mixins/record.js index 969d93a78..f16f885ec 100644 --- a/client/web/compose/src/mixins/record.js +++ b/client/web/compose/src/mixins/record.js @@ -1,7 +1,7 @@ // This mixin is used on View component of Records. import { compose, validator, NoID } from '@cortezaproject/corteza-js' -import { mapGetters, mapActions } from 'vuex' +import { mapGetters } from 'vuex' import { throttle } from 'lodash' export default { @@ -66,10 +66,6 @@ export default { }, methods: { - ...mapActions({ - updatePrompts: 'wfPrompts/update', - }), - /** * Handle form submit for record create & update * @@ -170,7 +166,6 @@ export default { record = new compose.Record(this.module, r) }) .then(() => this.dispatchUiEvent('afterFormSubmit', record, { $records: records })) - .then(() => this.updatePrompts()) .then(() => { if (record.valueErrors.set) { throw new Error(this.toastWarning(this.$t('notification:record.validationWarnings'))) @@ -239,7 +234,6 @@ export default { record = new compose.Record(this.module, r) }) .then(() => this.dispatchUiEvent('afterFormSubmit', record)) - .then(() => this.updatePrompts()) .then(() => { if (this.record.valueErrors.set) { this.toastWarning(this.$t('notification:record.validationWarnings')) @@ -272,7 +266,6 @@ export default { .dispatchUiEvent('beforeDelete') .then(() => this.$ComposeAPI.recordDelete(this.record)) .then(this.dispatchUiEvent('afterDelete')) - .then(this.updatePrompts()) .then(() => { this.record = undefined this.initialRecordState = undefined @@ -293,7 +286,6 @@ export default { .dispatchUiEvent('beforeUndelete') .then(() => this.$ComposeAPI.recordUndelete(this.record)) .then(this.dispatchUiEvent('afterUndelete')) - .then(this.updatePrompts()) .then(() => { this.record = undefined this.initialRecordState = undefined @@ -338,7 +330,6 @@ export default { throw err }) - .then(this.updatePrompts()) .then(() => { this.toastSuccess(this.$t('notification:record.bulkRecordUpdateSuccess')) this.onModalHide() diff --git a/lib/vue/src/components/prompts/CPromptToast.vue b/lib/vue/src/components/prompts/CPromptToast.vue index 6921da14b..6a4d1a32d 100644 --- a/lib/vue/src/components/prompts/CPromptToast.vue +++ b/lib/vue/src/components/prompts/CPromptToast.vue @@ -36,12 +36,13 @@ export default { props: { hideToasts: { type: Boolean, + default: false, }, }, data () { return { - passive: new Set(), + passive: [], hasFocus: null, hasFocusObserver: 0, @@ -96,7 +97,7 @@ export default { */ toasts () { return this.hideToasts ? [] : [ - ...this.passive.values(), + ...this.passive, ...this.active ] }, @@ -128,8 +129,8 @@ export default { immediate: true, handler (wc) { wc.forEach(p => { - if (p.passive) { - this.passive.add(p) + if (p.passive && !this.passive.some(({ prompt }) => prompt.stateID === p.prompt.stateID)) { + this.passive.push(p) } }) }, @@ -161,10 +162,14 @@ export default { this.resume(values) }, - onToastHide ({ prompt, passive}) { - if (passive) return - - this.cancel(prompt) + onToastHide ({ prompt, passive }) { + setTimeout(() => { + if (passive) { + this.passive = this.passive.filter(({ prompt: p }) => p.stateID !== prompt.stateID) + } else { + this.cancel(prompt) + } + }, 300) }, pVal (prompt, k, def = undefined) { diff --git a/lib/vue/src/components/prompts/CPrompts.vue b/lib/vue/src/components/prompts/CPrompts.vue index 576488bae..4f9487f4c 100644 --- a/lib/vue/src/components/prompts/CPrompts.vue +++ b/lib/vue/src/components/prompts/CPrompts.vue @@ -1,8 +1,6 @@ @@ -29,6 +27,7 @@ export default { props: { hideToasts: { type: Boolean, + default: false, }, }, }