Set the decorations and previousDecorations vars before loops

Both loops use both vars, so both need to be available before the 
diffing!
This commit is contained in:
Ben Ogle
2014-06-20 11:29:18 -07:00
parent e8db3e97ce
commit aef6991ca8

View File

@@ -207,11 +207,14 @@ LinesComponent = React.createClass
{editor, lineHeightInPixels, lineDecorations} = @props
lineNode = @lineNodesByLineId[line.id]
if previousDecorations = @renderedDecorationsByLineId[line.id]
decorations = lineDecorations[screenRow]
previousDecorations = @renderedDecorationsByLineId[line.id]
if previousDecorations?
for decoration in previousDecorations
lineNode.classList.remove(decoration.class) if editor.decorationMatchesType(decoration, 'line') and not _.deepContains(decorations, decoration)
if decorations = lineDecorations[screenRow]
if decorations?
for decoration in decorations
if editor.decorationMatchesType(decoration, 'line') and not _.deepContains(previousDecorations, decoration)
lineNode.classList.add(decoration.class)