I’ve read the huge doc demo in the main site, and found some topic discussed about the way to update the editor. However when I use the dispatch
function to insert a huge text, codemirror will create ten-thousands of dom nodes in the background and freeze the page for a while.
I then tried another way – re-creating the editor view with { doc: Text.of(hugeText.split('\n')) }
, and it’s working without any notice-able performance issue.
Am I doing right here? Is there any other way to replace the entire view.state.doc
without hurting the performance?