Do not show toggle arrow if link data is still loading

This commit is contained in:
Pavel Djundik 2018-09-24 13:41:56 +03:00
parent 05303e4cf1
commit e5b3c518e2
2 changed files with 6 additions and 5 deletions

View File

@ -146,11 +146,6 @@ export default {
this.link.shown = this.link.shown && shouldOpenByDefault; this.link.shown = this.link.shown && shouldOpenByDefault;
}, },
mounted() { mounted() {
// Don't display previews while they are loading on the server
if (this.link.type === "loading") {
return;
}
this.$root.$on("resize", this.handleResize); this.$root.$on("resize", this.handleResize);
this.onPreviewUpdate(); this.onPreviewUpdate();
@ -165,6 +160,11 @@ export default {
}, },
methods: { methods: {
onPreviewUpdate() { onPreviewUpdate() {
// Don't display previews while they are loading on the server
if (this.link.type === "loading") {
return;
}
// Error don't have any media to render // Error don't have any media to render
if (this.link.type === "error") { if (this.link.type === "error") {
this.onPreviewReady(); this.onPreviewReady();

View File

@ -1,5 +1,6 @@
<template> <template>
<button <button
v-if="link.type !== 'loading'"
:class="['toggle-button', 'toggle-preview', { opened: link.shown }]" :class="['toggle-button', 'toggle-preview', { opened: link.shown }]"
@click="onClick" /> @click="onClick" />
</template> </template>