Skip to content

Commit 692fbf1

Browse files
committed
Actually update blame view upon save
In the last commit I think I simplified the code and tricked myself into thinking I tested it, but I must have not reloaded the package. This commit works though. Test plan: First test editing when view is open: * Open blame * Add some newlines * Save file * See blame view update Now test it updates upon second display: * Open blame * Close blame * Add some newlines * Save file * Open blame again * See it update
1 parent cd0fec2 commit 692fbf1

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

lib/views/blame-line-view.coffee

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,4 +50,7 @@ BlameLineComponent = React.createClass
5050
componentWillUnmount: ->
5151
$(@getDOMNode()).tooltip "destroy"
5252

53+
shouldComponentUpdate: ({hash}) ->
54+
hash isnt @props.hash
55+
5356
module.exports = {BlameLineComponent, renderLoading}

lib/views/blame-list-view.coffee

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ BlameListLinesComponent = React.createClass
99
propTypes:
1010
annotations: RP.arrayOf(RP.object)
1111
loading: RP.bool.isRequired
12+
dirty: RP.bool.isRequired
1213
initialLineCount: RP.number.isRequired
1314
remoteRevision: RP.object.isRequired
1415

@@ -48,9 +49,10 @@ BlameListLinesComponent = React.createClass
4849
else
4950
@renderLoaded()
5051

51-
shouldComponentUpdate: ({loading}) ->
52-
loading isnt @props.loading
53-
52+
shouldComponentUpdate: ({loading, dirty}) ->
53+
finishedInitialLoad = @props.loading and not loading and not @props.dirty
54+
finishedEdit = @props.dirty and not dirty
55+
finishedInitialLoad or finishedEdit
5456

5557
BlameListView = React.createClass
5658
propTypes:
@@ -88,10 +90,10 @@ BlameListView = React.createClass
8890
style: WebkitTransform: @getTransform()
8991
BlameListLinesComponent
9092
annotations: @state.annotations
91-
loading: @state.loading and not @state.dirty
93+
loading: @state.loading
94+
dirty: @state.dirty
9295
initialLineCount: @editor().getLineCount()
9396
remoteRevision: @props.remoteRevision
94-
9597
div
9698
className: 'git-blame'
9799
style: width: @state.width, display: display

0 commit comments

Comments
 (0)