fix(asv3): render finalised messages on mount in MarkdownBlock#409
Open
Luis85 wants to merge 1 commit into
Open
fix(asv3): render finalised messages on mount in MarkdownBlock#409Luis85 wants to merge 1 commit into
Luis85 wants to merge 1 commit into
Conversation
The native-renderer branch installed by PR #377 used a single `watch(() => props.text, ..., { immediate: true, flush: 'post' })` to drive every render. Inside Obsidian's view lifecycle with Vue 3.5, the immediate run consistently fires before the template ref is bound: `nativeContainer.value` is still `null` and `rerenderNative()` returns early. For completed message bubbles whose `text` never changes again after mount, that early-return is terminal — the body stays empty. Streaming bubbles previously hid this because their `text` keeps growing post-mount, so subsequent watcher firings render the text after the container has bound. Add an explicit `onMounted` trigger so finalised messages get one post-mount render even when their text never changes. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
watch(() => props.text, ..., { immediate: true, flush: 'post' })to drive every render.nativeContainer.valueis stillnull, sorerenderNative()returns early.textnever changes again after mount, that early-return is terminal: the body stays empty even though the rendered scratch div is fully populated for streaming bubbles.textkeeps growing post-mount, so subsequent watcher firings end up rendering after the container has bound.onMounted(() => void rerenderNative())so finalised messages get one post-mount render even when their text never changes.How it was caught
MarkdownBlock.vueconfirmed: the watch's immediate run reported "no el" before mount; the final-message instances mounted (onMountedfired, container bound) but no second watcher firing followed, sincetextis immutable post-finalisation.textgrows) re-fired the watcher and rendered correctly — masking the bug.Test plan
npm run typecheck— clean (0 errors)npm run lint— 0 errorsnpm run test— 1863 / 1863 passingnpm run build— clean bundle🤖 Generated with Claude Code