1- import React , { useEffect , useCallback , useReducer } from "react" ;
1+ import React , { useEffect , useCallback , useReducer , useState } from "react" ;
22import { useRouter } from "next/router" ;
33import { SigninToContinueBannerPrmoptProvider } from "components/prompt-banner-signin-to-continue" ;
44import { Editor , EditorDefaultProviders } from "scaffolds/editor" ;
@@ -13,6 +13,8 @@ export default function FileEntryEditor() {
1313 const { key } = router . query ;
1414 const filekey = key as string ;
1515
16+ const [ loading , setLoading ] = useState < boolean > ( true ) ;
17+
1618 const [ initialState , initialDispatcher ] = useReducer ( warmup . initialReducer , {
1719 type : "pending" ,
1820 } ) ;
@@ -28,6 +30,11 @@ export default function FileEntryEditor() {
2830
2931 useEffect ( ( ) => {
3032 if ( file ) {
33+ if ( ! file . __initial ) {
34+ // when full file is loaded, allow editor with user interaction.
35+ setLoading ( false ) ;
36+ }
37+
3138 let val : EditorSnapshot ;
3239
3340 // TODO: seed this as well
@@ -76,7 +83,7 @@ export default function FileEntryEditor() {
7683 < SigninToContinueBannerPrmoptProvider >
7784 < StateProvider state = { safe_value } dispatch = { handleDispatch } >
7885 < EditorDefaultProviders >
79- < Editor />
86+ < Editor loading = { loading } />
8087 </ EditorDefaultProviders >
8188 </ StateProvider >
8289 </ SigninToContinueBannerPrmoptProvider >
0 commit comments