fix: avoid active editor remount on unrelated vault refresh

This commit is contained in:
lucaronin
2026-05-01 11:40:14 +02:00
parent acb35cb5df
commit 8b36ff6b00
6 changed files with 118 additions and 13 deletions

View File

@@ -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 () => {