File tree Expand file tree Collapse file tree 2 files changed +16
-1
lines changed
packages/app/src/app/components/Preview/DevTools/Console Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,10 @@ export const Messages = styled.div`
1717 overflow-y: auto;
1818 overflow-x: hidden;
1919 white-space: pre-wrap;
20+
21+ > div {
22+ overflow-y: auto;
23+ }
2024` ;
2125
2226export const IconContainer = styled . div `
Original file line number Diff line number Diff line change 11import React from 'react' ;
22import { listen , dispatch } from 'codesandbox-api' ;
3+ import { debounce } from 'lodash' ;
34import update from 'immutability-helper' ;
45
56import ClearIcon from 'react-icons/lib/md/clear-all' ;
@@ -24,6 +25,12 @@ class Console extends React.Component {
2425
2526 listener ;
2627
28+ constructor ( props ) {
29+ super ( props ) ;
30+
31+ this . scrollToBottom = debounce ( this . scrollToBottom , 1 / 60 ) ;
32+ }
33+
2734 componentDidMount ( ) {
2835 this . listener = listen ( this . handleMessage ) ;
2936 }
@@ -165,10 +172,14 @@ class Console extends React.Component {
165172
166173 componentDidUpdate ( ) {
167174 if ( this . list ) {
168- this . list . scrollTop = this . list . scrollHeight ;
175+ this . scrollToBottom ( ) ;
169176 }
170177 }
171178
179+ scrollToBottom = ( ) => {
180+ this . list . scrollTop = this . list . scrollHeight ;
181+ } ;
182+
172183 evaluateConsole = ( command : string ) => {
173184 this . addMessage ( 'command' , [ command ] ) ;
174185
You can’t perform that action at this time.
0 commit comments