fix: avoid active editor remount on unrelated vault refresh
This commit is contained in:
@@ -43,14 +43,24 @@ describe('refreshPulledVaultState', () => {
|
||||
expect(options.replaceActiveTab).toHaveBeenCalledWith(entries[0])
|
||||
})
|
||||
|
||||
it('reloads the active tab after any successful pull with updates', async () => {
|
||||
it('keeps the active tab mounted when updates do not include the active note', async () => {
|
||||
const options = makeOptions({ updatedFiles: ['project/plan.md'] })
|
||||
|
||||
await refreshPulledVaultState(options)
|
||||
|
||||
expect(options.reloadVault).toHaveBeenCalledOnce()
|
||||
expect(options.closeAllTabs).not.toHaveBeenCalled()
|
||||
expect(options.replaceActiveTab).toHaveBeenCalledWith(expect.objectContaining({ path: '/vault/active.md' }))
|
||||
expect(options.replaceActiveTab).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('keeps the active tab mounted for full watcher refreshes with unknown changed files', async () => {
|
||||
const options = makeOptions({ updatedFiles: [] })
|
||||
|
||||
await refreshPulledVaultState(options)
|
||||
|
||||
expect(options.reloadVault).toHaveBeenCalledOnce()
|
||||
expect(options.closeAllTabs).not.toHaveBeenCalled()
|
||||
expect(options.replaceActiveTab).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('matches macOS /tmp and /private/tmp aliases when reloading the active tab entry', async () => {
|
||||
|
||||
Reference in New Issue
Block a user