Skip to content

Commit

Permalink
Fix corner cases related to lifecycle state of EditorComponent on events
Browse files Browse the repository at this point in the history
Signed-off-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
  • Loading branch information
Nathan Sobo committed Nov 4, 2014
1 parent 9b70cf2 commit 100af7d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/scrollbar-component.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ ScrollbarComponent = React.createClass

@getDOMNode().addEventListener 'scroll', @onScroll

componentWillUnmount: ->
@getDOMNode().removeEventListener 'scroll', @onScroll

shouldComponentUpdate: (newProps) ->
return true if newProps.visible isnt @props.visible

Expand Down
3 changes: 2 additions & 1 deletion src/text-editor-component.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,8 @@ TextEditorComponent = React.createClass
@refs.input.focus()

blurred: ->
@setState(focused: false)
if @isMounted()
@setState(focused: false)

onTextInput: (event) ->
event.stopPropagation()
Expand Down
2 changes: 1 addition & 1 deletion src/text-editor-element.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ class TextEditorElement extends HTMLElement

blurred: (event) ->
unless atom.config.get('editor.useShadowDOM')
if event.relatedTarget is @component?.refs.input.getDOMNode()
if event.relatedTarget is @component?.refs.input?.getDOMNode()
event.stopImmediatePropagation()
return

Expand Down

0 comments on commit 100af7d

Please sign in to comment.