mirror of
https://github.com/atom/atom.git
synced 2026-01-24 14:28:14 -05:00
Skip the first reload event.
This commit is contained in:
@@ -1056,9 +1056,15 @@ export default class GitRepositoryAsync {
|
||||
}
|
||||
}
|
||||
|
||||
// TextBuffers will emit a reload event when they're first loaded. We don't
|
||||
// need to refresh in that case.
|
||||
let firstReload = true
|
||||
bufferSubscriptions.add(
|
||||
buffer.onDidSave(refreshStatusForBuffer),
|
||||
buffer.onDidReload(refreshStatusForBuffer),
|
||||
buffer.onDidReload(() => {
|
||||
if (!firstReload) refreshStatusForBuffer()
|
||||
firstReload = false
|
||||
}),
|
||||
buffer.onDidChangePath(refreshStatusForBuffer),
|
||||
buffer.onDidDestroy(() => {
|
||||
bufferSubscriptions.dispose()
|
||||
|
||||
@@ -448,7 +448,14 @@ class GitRepository
|
||||
|
||||
bufferSubscriptions = new CompositeDisposable
|
||||
bufferSubscriptions.add buffer.onDidSave(getBufferPathStatus)
|
||||
bufferSubscriptions.add buffer.onDidReload(getBufferPathStatus)
|
||||
|
||||
# TextBuffers will emit a reload event when they're first loaded. We don't
|
||||
# need to refresh in that case.
|
||||
firstReload = true
|
||||
bufferSubscriptions.add buffer.onDidReload(->
|
||||
getBufferPathStatus() unless firstReload
|
||||
firstReload = false
|
||||
)
|
||||
bufferSubscriptions.add buffer.onDidChangePath(getBufferPathStatus)
|
||||
bufferSubscriptions.add buffer.onDidDestroy =>
|
||||
bufferSubscriptions.dispose()
|
||||
|
||||
Reference in New Issue
Block a user