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

Wrap view.dispatch in setTimeout (#21365)

GitOrigin-RevId: 61c19e10f9529b4d7913f01c57281931533153d2
Alf Eaton 1 год назад
Родитель
Сommit
516a7abc2a

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

@@ -232,7 +232,9 @@ function useCodeMirrorScope(view: EditorView) {
       spellCheckLanguage,
       hunspellManager,
     }
-    view.dispatch(setSpellCheckLanguage(spellingRef.current))
+    window.setTimeout(() => {
+      view.dispatch(setSpellCheckLanguage(spellingRef.current))
+    })
   }, [view, spellCheckLanguage, hunspellManager])
 
   const projectFeaturesRef = useRef(projectFeatures)