mirror of
https://gitlab.silvrtree.co.uk/martind2000/nci.git
synced 2025-02-14 20:09:17 +00:00
use separate row component with shouldUpdate
This commit is contained in:
parent
548ddcd0fa
commit
e9a1be2e6d
4
static/js/app/components/terminal/row.jade
Normal file
4
static/js/app/components/terminal/row.jade
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
.code-line
|
||||||
|
span.code-line_counter
|
||||||
|
.code-line_body!= this.props.row
|
||||||
|
|
@ -1,8 +1,6 @@
|
|||||||
.terminal
|
.terminal
|
||||||
pre.terminal_code(ref="code")
|
pre.terminal_code(ref="code")
|
||||||
each row, index in this.state.data
|
each row, index in this.state.data
|
||||||
.code-line(key=index)
|
Row(row=row, key=index)
|
||||||
span.code-line_counter
|
|
||||||
.code-line_body!= row
|
|
||||||
|
|
||||||
.terminal_footer(style={height: '30px'})
|
.terminal_footer(style={height: '30px'})
|
||||||
|
@ -6,8 +6,20 @@ define([
|
|||||||
'reflux',
|
'reflux',
|
||||||
'app/stores/terminal',
|
'app/stores/terminal',
|
||||||
'ansi_up',
|
'ansi_up',
|
||||||
'templates/app/components/terminal/terminal'
|
'templates/app/components/terminal/terminal',
|
||||||
], function(_, React, Reflux, terminalStore, ansiUp, template) {
|
'templates/app/components/terminal/row'
|
||||||
|
], function(_, React, Reflux, terminalStore, ansiUp, template, rowTemplate) {
|
||||||
|
var TerminalRow = React.createClass({
|
||||||
|
render: rowTemplate,
|
||||||
|
shouldComponentUpdate: function(nextProps) {
|
||||||
|
return nextProps.row !== this.props.row;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
template = template.locals({
|
||||||
|
Row: TerminalRow
|
||||||
|
});
|
||||||
|
|
||||||
var Component = React.createClass({
|
var Component = React.createClass({
|
||||||
mixins: [Reflux.ListenerMixin],
|
mixins: [Reflux.ListenerMixin],
|
||||||
shouldScrollBottom: true,
|
shouldScrollBottom: true,
|
||||||
|
Loading…
Reference in New Issue
Block a user