42772 condition editor error handling (#502)
* fix password reset bug * condition editor error handling * fix syntax error * fix syntax --------- Co-authored-by: Julien Nahum <julien@nahum.net>
This commit is contained in:
parent
d11f59210b
commit
90a53b4d0d
|
|
@ -8,7 +8,7 @@
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup>
|
||||||
const error = ref()
|
const error = ref()
|
||||||
const emit = defineEmits(['on-error'])
|
const emit = defineEmits(['on-error'])
|
||||||
function clearError() {
|
function clearError() {
|
||||||
|
|
@ -26,5 +26,8 @@
|
||||||
error.value = undefined
|
error.value = undefined
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
</script>
|
defineExpose({
|
||||||
|
clearError
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
@ -37,6 +37,7 @@
|
||||||
clearError()
|
clearError()
|
||||||
}
|
}
|
||||||
const onFormEditorError = (error) => {
|
const onFormEditorError = (error) => {
|
||||||
|
console.error('Form Editor Error Handled', error)
|
||||||
crisp.pauseChatBot()
|
crisp.pauseChatBot()
|
||||||
const eventData = {
|
const eventData = {
|
||||||
message: error.message,
|
message: error.message,
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
<template>
|
<template>
|
||||||
|
<ErrorBoundary @on-error="handleError" ref="error_boundary">
|
||||||
<query-builder
|
<query-builder
|
||||||
v-model="query"
|
v-model="query"
|
||||||
:rules="rules"
|
:rules="rules"
|
||||||
|
|
@ -35,6 +36,7 @@
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
</query-builder>
|
</query-builder>
|
||||||
|
</ErrorBoundary>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
@ -130,7 +132,16 @@ export default {
|
||||||
onChange() {
|
onChange() {
|
||||||
this.$emit("update:modelValue", this.query)
|
this.$emit("update:modelValue", this.query)
|
||||||
},
|
},
|
||||||
},
|
// If there was some changes to the structure, causing an issue, we clear the condition
|
||||||
|
handleError (error) {
|
||||||
|
this.$nextTick(() => {
|
||||||
|
console.error('Error with condition - clearing previous value', error)
|
||||||
|
this.query = null
|
||||||
|
this.onChange()
|
||||||
|
this.$refs['error_boundary'].clearError()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<style src="query-builder-vue-3/dist/style.css" />
|
<style src="query-builder-vue-3/dist/style.css" />
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue