Merge branch 'main' into fix/710-numeric-property-rendered-as-ipv4

This commit is contained in:
github-actions[bot]
2026-05-20 16:35:57 +00:00
committed by GitHub
2 changed files with 15 additions and 7 deletions

View File

@@ -92,17 +92,30 @@ describe('refreshPulledVaultState', () => {
expect(options.closeAllTabs).not.toHaveBeenCalled()
})
it('keeps the active tab mounted while the editor is focused', async () => {
it('refreshes the focused active tab when an external watcher update changed that note', async () => {
const options = makeOptions({
shouldKeepActiveEditorMounted: vi.fn(() => true),
})
await refreshPulledVaultState(options)
expect(options.shouldKeepActiveEditorMounted).toHaveBeenCalledOnce()
expect(options.shouldKeepActiveEditorMounted).not.toHaveBeenCalled()
expect(options.reloadVault).toHaveBeenCalledOnce()
expect(options.reloadFolders).toHaveBeenCalledOnce()
expect(options.reloadViews).toHaveBeenCalledOnce()
expect(options.closeAllTabs).toHaveBeenCalledOnce()
expect(options.replaceActiveTab).toHaveBeenCalledWith(makeEntry('/vault/active.md', 'Active'))
})
it('keeps the active tab mounted while focused when the active note was not changed', async () => {
const options = makeOptions({
shouldKeepActiveEditorMounted: vi.fn(() => true),
updatedFiles: ['other.md'],
})
await refreshPulledVaultState(options)
expect(options.shouldKeepActiveEditorMounted).not.toHaveBeenCalled()
expect(options.replaceActiveTab).not.toHaveBeenCalled()
expect(options.closeAllTabs).not.toHaveBeenCalled()
})

View File

@@ -71,7 +71,6 @@ function shouldReplaceActiveEntry(options: {
activePath: string
movedEntry: VaultEntry | null
refreshedEntry: VaultEntry | null
shouldKeepActiveEditorMounted?: () => boolean
updatedFiles: string[]
vaultPath: string
}): boolean {
@@ -79,13 +78,11 @@ function shouldReplaceActiveEntry(options: {
activePath,
movedEntry,
refreshedEntry,
shouldKeepActiveEditorMounted,
updatedFiles,
vaultPath,
} = options
if (movedEntry) return true
if (!refreshedEntry) return false
if (shouldKeepActiveEditorMounted?.() === true) return false
return didPullUpdateActiveNote({ updatedFiles, vaultPath, activeTabPath: activePath })
}
@@ -99,7 +96,6 @@ export async function refreshPulledVaultState(options: PulledVaultRefreshOptions
closeAllTabs,
getActiveTabPath,
hasUnsavedChanges,
shouldKeepActiveEditorMounted,
reloadFolders,
reloadVault,
reloadViews,
@@ -131,7 +127,6 @@ export async function refreshPulledVaultState(options: PulledVaultRefreshOptions
activePath,
movedEntry,
refreshedEntry,
shouldKeepActiveEditorMounted,
updatedFiles,
vaultPath,
})) {