diff --git a/src/App.note-window-properties.test.tsx b/src/App.note-window-properties.test.tsx
index 0be3c277..39f1c1c7 100644
--- a/src/App.note-window-properties.test.tsx
+++ b/src/App.note-window-properties.test.tsx
@@ -132,7 +132,13 @@ const relatedEntry = makeEntry({
title: 'Software Development',
isA: 'Topic',
})
-const entries = [activeEntry, relatedEntry]
+const secondEntry = makeEntry({
+ path: '/vault/project/second.md',
+ filename: 'second.md',
+ title: 'Second Project',
+ isA: 'Project',
+})
+const entries = [activeEntry, relatedEntry, secondEntry]
const noteContent = '---\ntitle: Test Project\ntype: Project\n---\n\n# Test Project\n'
const defaultVaultPath = DEFAULT_VAULTS[0].path || '/Users/mock/Documents/Getting Started'
@@ -215,7 +221,7 @@ describe('App note windows', () => {
)
})
- it('passes the loaded vault index to the editor in note windows', async () => {
+ it('keeps note windows scoped to the active entry without loading the vault index', async () => {
renderApp()
await waitFor(() => {
@@ -224,18 +230,44 @@ describe('App note windows', () => {
vaultPath: '/vault',
})
})
- await waitFor(() => {
- expect(commandResults.list_vault).toHaveBeenCalledWith({ path: '/vault' })
- })
+ expect(commandResults.list_vault).not.toHaveBeenCalled()
await waitFor(() => {
expect(screen.getByTestId('mock-editor-entry-titles')).toHaveTextContent(
- 'Test Project|Software Development',
+ 'Test Project',
)
})
expect(editorSnapshots.at(-1)).toEqual({
activeTabPath: activeEntry.path,
- entryTitles: ['Test Project', 'Software Development'],
+ entryTitles: ['Test Project'],
})
})
+
+ it('opens repeated note windows without repeated full-vault scans', async () => {
+ const firstWindow = renderApp()
+
+ await waitFor(() => {
+ expect(commandResults.reload_vault_entry).toHaveBeenCalledWith({
+ path: activeEntry.path,
+ vaultPath: '/vault',
+ })
+ })
+ firstWindow.unmount()
+
+ window.history.replaceState(
+ {},
+ '',
+ '/?window=note&path=%2Fvault%2Fproject%2Fsecond.md&vault=%2Fvault&title=Second+Project',
+ )
+ renderApp()
+
+ await waitFor(() => {
+ expect(commandResults.reload_vault_entry).toHaveBeenCalledWith({
+ path: secondEntry.path,
+ vaultPath: '/vault',
+ })
+ })
+ expect(commandResults.reload_vault_entry).toHaveBeenCalledTimes(2)
+ expect(commandResults.list_vault).not.toHaveBeenCalled()
+ })
})
diff --git a/src/App.test.tsx b/src/App.test.tsx
index 8f01d18e..603d6a79 100644
--- a/src/App.test.tsx
+++ b/src/App.test.tsx
@@ -576,7 +576,7 @@ describe('App', () => {
})
})
- it('opens a note window by loading the requested entry and vault index', async () => {
+ it('opens a note window by loading only the requested entry', async () => {
const listVault = vi.fn(() => mockEntries)
const reloadVaultEntry = vi.fn(({ path }: { path: string }) =>
mockEntries.find((entry) => entry.path === path) ?? null,
@@ -599,7 +599,7 @@ describe('App', () => {
expect(getNoteContent).toHaveBeenCalledWith({ path: '/vault/project/test.md', vaultPath: '/vault' })
await waitFor(() => expect(window.__laputaTest?.activeTabPath).toBe('/vault/project/test.md'))
expect(screen.getByTestId('blocknote-view')).toHaveAttribute('data-editable', 'true')
- expect(listVault).toHaveBeenCalledWith({ path: '/vault' })
+ expect(listVault).not.toHaveBeenCalled()
})
it('shows keyboard shortcut hints', async () => {
diff --git a/src/App.tsx b/src/App.tsx
index 3fa7de14..5cd0752c 100644
--- a/src/App.tsx
+++ b/src/App.tsx
@@ -368,7 +368,7 @@ function App() {
})
const vault = useVaultLoader(
- resolvedPath,
+ noteWindowParams ? '' : resolvedPath,
graphVaults,
multiWorkspaceEnabled ? defaultWorkspacePath : null,
folderVaults,
@@ -1687,7 +1687,7 @@ function App() {
tabs={notes.tabs}
activeTabPath={notes.activeTabPath}
isVaultLoading={isVaultContentLoading}
- entries={visibleEntries}
+ entries={noteWindowParams && activeTab ? [activeTab.entry] : visibleEntries}
onNavigateWikilink={notes.handleNavigateWikilink}
onLoadDiff={loadDiffForPath}
onLoadDiffAtCommit={loadDiffAtCommitForPath}