use useCallback for useGutterClickHandler

main
Mike Fix 5 years ago
parent 7510dcb5ea
commit d43c5766cf

@ -322,7 +322,7 @@ function useGutterClickHandler(props) {
} }
}, [state.selected, props.children, props.config]) }, [state.selected, props.children, props.config])
return function onGutterClick(editor, lineNumber, gutter, e) { return React.useCallback(function onGutterClick(editor, lineNumber, gutter, e) {
editorRef.current = editor editorRef.current = editor
const numLines = editor.display.view.length const numLines = editor.display.view.length
@ -331,7 +331,7 @@ function useGutterClickHandler(props) {
} else { } else {
dispatch({ type: 'LINE', lineNumber, numLines }) dispatch({ type: 'LINE', lineNumber, numLines })
} }
} }, [])
} }
function CarbonContainer(props, ref) { function CarbonContainer(props, ref) {

Loading…
Cancel
Save