         @scheduleUpdate() if changedPath is @editor.getPath()
 
   cancelUpdate: ->
-    clearImmediate(@immediateId)
+    clearTimeout(@timeoutId)
 
-  scheduleUpdate: =>
+  scheduleUpdate: (timeout = 50)=>
     @cancelUpdate()
-    @immediateId = setImmediate(@updateDiffs)
+    @timeoutId = setTimeout(@updateDiffs, timeout)
 
   updateDiffs: =>
     return if @editor.isDestroyed()

    editorElement = atom.views.getView(editor)
    @subscriptions.add atom.commands.add editorElement, 'git-diff-staged:update-diffs', @scheduleUpdate

    @scheduleUpdate()

  reset: ->
    @subscriptions = new CompositeDisposable()
    @decorations = {}
    @markers = []
    @immediateId = @repository = @editor = null

  dispose: =>
    @cancelUpdate()

    @reset()
    @editor = editor

    @subscriptions.add @editor.onDidChange(@scheduleUpdate)
    @subscriptions.add @editor.onDidChangePath(@scheduleUpdate)

    @subscribeToRepository()
    @subscriptions.add atom.project.onDidChangePaths @subscribeToRepository
