Refactor EventPreview to shared MVVM#33646
Open
ZacksBot wants to merge 7 commits into
Open
Conversation
23 tasks
dbkr
reviewed
May 29, 2026
|
|
||
| this.disposables.track(() => this.eventContentListener.teardown()); | ||
| this.eventContentListener.setEvent(props.mxEvent, this.onEventContentChanged); | ||
| void this.updatePreview(); |
Member
There was a problem hiding this comment.
this also might benefit from being in a catch block (and wrapper, probably)?
|
|
||
| private async updatePreview(): Promise<void> { | ||
| const { cli, mxEvent } = this.props; | ||
| const requestId = ++this.previewRequestId; |
Member
There was a problem hiding this comment.
We'll only actually need to wait for the event to be decrypted once here in practice so you could also just set an 'updating preview' flag and return if it's set, or it may not even matter at all. That said, this should work fine too, so doesn't really matter.
| const mxEvent = makeMessageEvent({ body: "Text preview" }); | ||
| const vm = new EventPreviewViewModel({ cli, mxEvent }); | ||
|
|
||
| await flushPromises(); |
Member
There was a problem hiding this comment.
If this isn't marked deprecated then it should be: it's much better to find something to waitFor instead
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.
Refactor EventPreview into shared component using MVVM pattern and remove legacy component
Fixes: https://github.com/element-hq/wat-internal/issues/486