File tree Expand file tree Collapse file tree 3 files changed +11
-10
lines changed
client/packages/lowcoder/src Expand file tree Collapse file tree 3 files changed +11
-10
lines changed Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ import { CodeEditorPanel } from "../../pages/editor/codeEditorPanel";
1414import type { CodeEditorProps , StyleName } from "./codeEditorTypes" ;
1515import { useClickCompNameEffect } from "./clickCompName" ;
1616import { Layers } from "../../constants/Layers" ;
17+ import { debounce } from "lodash" ;
1718
1819type StyleConfig = {
1920 minHeight : string ;
@@ -219,12 +220,12 @@ function useCodeMirror(
219220 const showLineNum = props . showLineNum ?? getStyle ( props . styleName ) . showLineNum ;
220221
221222 const handleChange = useCallback (
222- ( state : EditorState ) => {
223+ debounce ( ( state : EditorState ) => {
223224 window . clearTimeout ( isTypingRef . current ) ;
224225 isTypingRef . current = window . setTimeout ( ( ) => ( isTypingRef . current = 0 ) , 100 ) ;
225226 onChange ?.( state ) ;
226- } ,
227- [ onChange ]
227+ } , 100 )
228+ , [ onChange ]
228229 ) ;
229230
230231 const { extensions, reconfigure, isFocus } = useExtensions ( {
Original file line number Diff line number Diff line change @@ -100,18 +100,18 @@ export function codeControl<
100100 this . _exposingNode = withFunction ( this . _node , ( x ) => x . value ) ;
101101
102102 // make sure handleChange's reference only changes when the instance changes, avoid CodeEditor frequent reconfigure
103- this . handleChange = debounce ( ( state : EditorState ) => {
103+ this . handleChange = ( state : EditorState ) => {
104104 this . dispatchChangeValueAction ( state . doc . toString ( ) ) ;
105- } , 50 ) ;
105+ } ;
106106 }
107107
108108 override changeDispatch ( dispatch : DispatchType ) {
109109 // need to re-bind handleChange when dispatch changes, otherwise old instance's dispatch is still in use
110110 const comp = setFieldsNoTypeCheck ( this , {
111111 dispatch,
112- handleChange : debounce ( ( state : EditorState ) => {
112+ handleChange : ( state : EditorState ) => {
113113 comp . dispatchChangeValueAction ( state . doc . toString ( ) ) ;
114- } , 50 ) ,
114+ } ,
115115 } ) ;
116116 return comp ;
117117 }
Original file line number Diff line number Diff line change @@ -75,11 +75,11 @@ export function ExtendedPropertyView<
7575 const [ compVersions , setCompVersions ] = useState ( [ 'latest' ] ) ;
7676 const [ compName , setCompName ] = useState ( '' ) ;
7777 const editorState = useContext ( EditorContext ) ;
78- const selectedComp = values ( editorState . selectedComps ( ) ) [ 0 ] ;
79- const compType = selectedComp . children . compType . getView ( ) as UICompType ;
78+ const selectedComp = values ( editorState ? .selectedComps ( ) ) [ 0 ] ;
79+ const compType = selectedComp ? .children ? .compType ? .getView ( ) as UICompType ;
8080
8181 useEffect ( ( ) => {
82- setCompName ( uiCompRegistry [ compType ] . compName || '' ) ;
82+ setCompName ( uiCompRegistry [ compType ] ? .compName || '' ) ;
8383 } , [ compType ] ) ;
8484
8585 useEffect ( ( ) => {
You can’t perform that action at this time.
0 commit comments