mirror of
https://github.com/atom/atom.git
synced 2026-02-16 01:25:13 -05:00
Defer the callback to the next tick.
This gives GitRepository the chance to clear its path cache before the callback is invoked. Otherwise reads from the cached status state within the callback would be wrong.
This commit is contained in:
@@ -166,7 +166,12 @@ class GitRepository
|
||||
#
|
||||
# Returns a {Disposable} on which `.dispose()` can be called to unsubscribe.
|
||||
onDidChangeStatuses: (callback) ->
|
||||
@async.onDidChangeStatuses callback
|
||||
@async.onDidChangeStatuses ->
|
||||
# Defer the callback to the next tick so that we've reset
|
||||
# `@statusesByPath` by the time it's called. Otherwise reads from within
|
||||
# the callback could be inconsistent.
|
||||
# See https://github.com/atom/atom/issues/11396
|
||||
process.nextTick callback
|
||||
|
||||
###
|
||||
Section: Repository Details
|
||||
|
||||
Reference in New Issue
Block a user