feat: Shows error message with retry for widget messages (#3594)

- Adds error message retry option for widget bubbles
- Adds a fallback for widget images with file type bubble
This commit is contained in:
Nithin David Thomas 2021-12-21 12:02:43 +05:30 committed by GitHub
parent 0130e08016
commit 307118b235
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 168 additions and 34 deletions

View file

@ -27,16 +27,14 @@
:class="wrapClass"
>
<div v-for="attachment in message.attachments" :key="attachment.id">
<file-bubble
v-if="attachment.file_type !== 'image'"
:url="attachment.data_url"
/>
<image-bubble
v-else
v-if="attachment.file_type === 'image' && !hasImageError"
:url="attachment.data_url"
:thumb="attachment.thumb_url"
:readable-time="readableTime"
@error="onImageLoadError"
/>
<file-bubble v-else :url="attachment.data_url" />
</div>
</div>
<p v-if="message.showAvatar || hasRecordedResponse" class="agent-name">
@ -83,6 +81,11 @@ export default {
default: () => {},
},
},
data() {
return {
hasImageError: false,
};
},
computed: {
shouldDisplayAgentMessage() {
if (
@ -170,5 +173,18 @@ export default {
};
},
},
watch: {
message() {
this.hasImageError = false;
},
},
mounted() {
this.hasImageError = false;
},
methods: {
onImageLoadError() {
this.hasImageError = true;
},
},
};
</script>