forked from AkkomaGang/akkoma-fe
fix infinite loop
This commit is contained in:
parent
f883d2f75c
commit
255f47fe56
2 changed files with 17 additions and 23 deletions
|
@ -42,7 +42,7 @@ export default Vue.component('RichContent', {
|
||||||
// NEVER EVER TOUCH DATA INSIDE RENDER
|
// NEVER EVER TOUCH DATA INSIDE RENDER
|
||||||
render (h) {
|
render (h) {
|
||||||
// Pre-process HTML
|
// Pre-process HTML
|
||||||
const { newHtml: html, lastMentions } = preProcessPerLine(this.html, this.greentext, this.hideLastMentions)
|
const { newHtml: html, lastMentions } = preProcessPerLine(this.html, this.greentext, this.hideMentions)
|
||||||
const firstMentions = [] // Mentions that appear in the beginning of post body
|
const firstMentions = [] // Mentions that appear in the beginning of post body
|
||||||
const lastTags = [] // Tags that appear at the end of post body
|
const lastTags = [] // Tags that appear at the end of post body
|
||||||
const writtenMentions = [] // All mentions that appear in post body
|
const writtenMentions = [] // All mentions that appear in post body
|
||||||
|
@ -187,6 +187,13 @@ export default Vue.component('RichContent', {
|
||||||
return item
|
return item
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// DO NOT USE SLOTS they cause a re-render feedback loop here.
|
||||||
|
// slots updated -> rerender -> emit -> update up the tree -> rerender -> ...
|
||||||
|
// at least until vue3?
|
||||||
|
const result = <span class="RichContent">
|
||||||
|
{ convertHtmlToTree(html).map(processItem).reverse().map(processItemReverse).reverse() }
|
||||||
|
</span>
|
||||||
|
|
||||||
const event = {
|
const event = {
|
||||||
firstMentions,
|
firstMentions,
|
||||||
lastMentions,
|
lastMentions,
|
||||||
|
@ -195,12 +202,6 @@ export default Vue.component('RichContent', {
|
||||||
writtenTags
|
writtenTags
|
||||||
}
|
}
|
||||||
|
|
||||||
const result = <span class="RichContent">
|
|
||||||
{ this.$slots.prefix }
|
|
||||||
{ convertHtmlToTree(html).map(processItem).reverse().map(processItemReverse).reverse() }
|
|
||||||
{ this.$slots.suffix }
|
|
||||||
</span>
|
|
||||||
|
|
||||||
// DO NOT MOVE TO UPDATE. BAD IDEA.
|
// DO NOT MOVE TO UPDATE. BAD IDEA.
|
||||||
this.$emit('parseReady', event)
|
this.$emit('parseReady', event)
|
||||||
|
|
||||||
|
|
|
@ -38,10 +38,11 @@
|
||||||
>
|
>
|
||||||
{{ $t("general.show_more") }}
|
{{ $t("general.show_more") }}
|
||||||
</button>
|
</button>
|
||||||
<span
|
<span v-if="!hideSubjectStatus && !(singleLine && status.summary_html)">
|
||||||
class="text-wrapper"
|
<MentionsLine
|
||||||
v-if="!hideSubjectStatus && !(singleLine && status.summary_html)"
|
v-if="!hideMentions && firstMentions && firstMentions.length > 0"
|
||||||
>
|
:mentions="firstMentions"
|
||||||
|
/>
|
||||||
<RichContent
|
<RichContent
|
||||||
:class="{ '-single-line': singleLine }"
|
:class="{ '-single-line': singleLine }"
|
||||||
class="text media-body"
|
class="text media-body"
|
||||||
|
@ -53,19 +54,11 @@
|
||||||
@parseReady="setHeadTailLinks"
|
@parseReady="setHeadTailLinks"
|
||||||
ref="text"
|
ref="text"
|
||||||
>
|
>
|
||||||
<template v-slot:prefix>
|
|
||||||
<MentionsLine
|
|
||||||
v-if="!hideMentions && firstMentions && firstMentions.length > 0"
|
|
||||||
:mentions="firstMentions"
|
|
||||||
/>
|
|
||||||
</template>
|
|
||||||
<template v-slot:suffix>
|
|
||||||
<MentionsLine
|
|
||||||
v-if="!hideMentions && lastMentions.length > 0 && firstMentions.length === 0"
|
|
||||||
:mentions="lastMentions"
|
|
||||||
/>
|
|
||||||
</template>
|
|
||||||
</RichContent>
|
</RichContent>
|
||||||
|
<MentionsLine
|
||||||
|
v-if="!hideMentions && lastMentions.length > 0 && firstMentions.length === 0"
|
||||||
|
:mentions="lastMentions"
|
||||||
|
/>
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
<button
|
<button
|
||||||
|
|
Loading…
Reference in a new issue