Просмотр исходного кода

Wrap setCursorHighlights in setTimeout (#12951)

GitOrigin-RevId: 204bf073bc2f4a014d9498c6a802fe38e52b22c5
Alf Eaton 3 лет назад
Родитель
Сommit
009a108c71

+ 3 - 1
services/web/frontend/js/features/source-editor/hooks/use-codemirror-scope.ts

@@ -436,7 +436,9 @@ function useCodeMirrorScope(view: EditorView) {
     if (cursorHighlights && currentDoc) {
       const items = cursorHighlights[currentDoc.doc_id]
       highlightsRef.current.cursorHighlights = items
-      view.dispatch(setCursorHighlights(items))
+      window.setTimeout(() => {
+        view.dispatch(setCursorHighlights(items))
+      })
     }
   }, [view, cursorHighlights, currentDoc])