Skip to content

Commit

Permalink
🐛 Fix DOM polling requesting an update on every call
Browse files Browse the repository at this point in the history
We’ll require a forced update only when the element become visible.
  • Loading branch information
abe33 committed Apr 2, 2015
1 parent f466703 commit 075d1a6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/minimap-element.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ class MinimapElement extends HTMLElement
# Internal: Polling callback used to detect visibility and size changes.
pollDOM: ->
if @isVisible()
@requestForcedUpdate() unless !@wasVisible
@requestForcedUpdate() unless @wasVisible

@measureHeightAndWidth(false)

Expand Down
2 changes: 2 additions & 0 deletions spec/minimap-element-spec.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,8 @@ describe 'MinimapElement', ->

describe 'from hidden to visible', ->
beforeEach ->
editorElement.style.display = 'none'
minimapElement.checkForVisibilityChange()
spyOn(minimapElement, 'requestForcedUpdate')
editorElement.style.display = ''
minimapElement.pollDOM()
Expand Down

0 comments on commit 075d1a6

Please sign in to comment.