Draft: (vue-3) render node only once #5041
Open
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.
Please describe your changes
In this PR we change the way nodes are rendered into Vue components and held in locale state during content loading.
For each node in
EditorContent.ts
, the current node and all its predecessors are rendered for each new node, which implies a performance issue.To avoid all nodes being rendered each time, we now keep the rendered nodes as a reference
How did you accomplish your changes
Since we cannot mutate the
Editor
props inrender
method ofEditorContent
, we move the logic to render a node inVueRenderer.ts
.Instead of keeping a Map of VueRenderer instance for each node, we keep the rendered VNodes in Map.
For each new node, we render it and add it to the existing Map.
The
render
method ofEditorContent
now retrieves the VNodes and renders them.How have you tested your changes
[add a detailed description of how you tested your changes here]
How can we verify your changes
[add a detailed description of how we can verify your changes here]
Remarks
[add any additional remarks here]
Checklist
Related issues
Link to the related issues here