@@ -36,13 +36,13 @@ import SysInfoFrame from './SysInfoFrame'
3636import ConnectionFrame from './Auth/ConnectionFrame'
3737import DisconnectFrame from './Auth/DisconnectFrame'
3838import ChangePasswordFrame from './Auth/ChangePasswordFrame'
39+ import QueriesFrame from './Queries/QueriesFrame'
3940import UserList from '../User/UserList'
4041import UserAdd from '../User/UserAdd'
4142import { getFrames , setRecentView , getRecentView } from 'shared/modules/stream/streamDuck'
4243import { getRequests } from 'shared/modules/requests/requestsDuck'
4344import { getActiveConnectionData } from 'shared/modules/connections/connectionsDuck'
44- import QueriesFrame from './Queries/QueriesFrame'
45- import { getMaxRows , getInitialNodeDisplay } from 'shared/modules/settings/settingsDuck'
45+ import { getMaxRows , getInitialNodeDisplay , getScrollToTop } from 'shared/modules/settings/settingsDuck'
4646
4747const getFrame = ( type ) => {
4848 const trans = {
@@ -70,7 +70,8 @@ const getFrame = (type) => {
7070
7171class Stream extends Component {
7272 shouldComponentUpdate ( nextProps , nextState ) {
73- const hasSameAmountOfFrames = this . props . frames . length === nextProps . frames . length
73+ const frameHasBeenAdded = this . props . frames . length < nextProps . frames . length
74+
7475 if ( this . props . activeConnectionData === nextProps . activeConnectionData &&
7576 this . props . requests === nextProps . requests &&
7677 ( this . props . children . length === nextProps . children . length &&
@@ -84,7 +85,7 @@ class Stream extends Component {
8485 ) {
8586 return false
8687 } else {
87- if ( ! hasSameAmountOfFrames ) {
88+ if ( this . props . scrollToTop && frameHasBeenAdded ) {
8889 this . base . scrollTop = 0
8990 }
9091 return true
@@ -121,7 +122,8 @@ const mapStateToProps = (state) => {
121122 activeConnectionData : getActiveConnectionData ( state ) ,
122123 recentView : getRecentView ( state ) ,
123124 maxRows : getMaxRows ( state ) ,
124- initialNodeDisplay : getInitialNodeDisplay ( state )
125+ initialNodeDisplay : getInitialNodeDisplay ( state ) ,
126+ scrollToTop : getScrollToTop ( state )
125127 }
126128}
127129
0 commit comments