@@ -4,12 +4,13 @@ import CodeMirror from 'codemirror';
44import { Encode } from 'console-feed' ;
55
66import RightArrowIcon from '../../../images/right-arrow.svg' ;
7+ import { dispatchConsoleEvent } from '../../IDE/actions/console' ;
78import { dispatchMessage , MessageTypes } from '../../../utils/dispatcher' ;
89
910// heavily inspired by
1011// https://github.com/codesandbox/codesandbox-client/blob/92a1131f4ded6f7d9c16945dc7c18aa97c8ada27/packages/app/src/app/components/Preview/DevTools/Console/Input/index.tsx
1112
12- function ConsoleInput ( { theme, dispatchConsoleEvent , fontSize } ) {
13+ function ConsoleInput ( { theme, fontSize } ) {
1314 const [ commandHistory , setCommandHistory ] = useState ( [ ] ) ;
1415 const [ commandCursor , setCommandCursor ] = useState ( - 1 ) ;
1516 const codemirrorContainer = useRef ( null ) ;
@@ -25,12 +26,6 @@ function ConsoleInput({ theme, dispatchConsoleEvent, fontSize }) {
2526 } ) ;
2627
2728 cmInstance . current . getWrapperElement ( ) . style [ 'font-size' ] = `${ fontSize } px` ;
28-
29- return ( ) => {
30- if ( cmInstance . current ) {
31- cmInstance . current = null ;
32- }
33- } ;
3429 } , [ ] ) ;
3530
3631 useEffect ( ( ) => {
@@ -78,7 +73,7 @@ function ConsoleInput({ theme, dispatchConsoleEvent, fontSize }) {
7873 cmInstance . current . off ( 'keydown' , handleEnterKey ) ;
7974 }
8075 } ;
81- } , [ commandHistory , dispatchConsoleEvent ] ) ;
76+ } , [ commandHistory ] ) ;
8277
8378 useEffect ( ( ) => {
8479 const handleUpArrowKey = ( cm , e ) => {
@@ -158,7 +153,6 @@ function ConsoleInput({ theme, dispatchConsoleEvent, fontSize }) {
158153
159154ConsoleInput . propTypes = {
160155 theme : PropTypes . string . isRequired ,
161- dispatchConsoleEvent : PropTypes . func . isRequired ,
162156 fontSize : PropTypes . number . isRequired
163157} ;
164158
0 commit comments