Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

fix: preserve ?vault= through the base /wiki redirect (#2544)

Adam Eivycc42bb6feea4
diff --git a/client/src/App.jsx b/client/src/App.jsx
index cb985bab27..7a95434037 100644
--- a/client/src/App.jsx
+++ b/client/src/App.jsx
@@ -345,7 +345,7 @@ export default function App() {
<Route path="video-gen" element={<RedirectWithSearch to="/media/video" />} />
<Route path="media-history" element={<RedirectWithSearch to="/media/history" />} />
<Route path="media-models" element={<RedirectWithSearch to="/media/models" />} />
- <Route path="wiki" element={<Navigate to="/wiki/overview" replace />} />
+ <Route path="wiki" element={<RedirectWithSearch to="/wiki/overview" />} />
<Route path="wiki/:tab" element={<Wiki />} />
<Route path="rapid-reader" element={<RapidReaderPage />} />
{/* `/universes` is the universe index (list/table). The editor lives
diff --git a/client/src/pages/Wiki.test.jsx b/client/src/pages/Wiki.test.jsx
index 3fe20a2248..c892e2f841 100644
--- a/client/src/pages/Wiki.test.jsx
+++ b/client/src/pages/Wiki.test.jsx
@@ -1,6 +1,6 @@
import { describe, it, expect, vi, beforeEach } from 'vitest';
import { render, screen, waitFor, fireEvent } from '@testing-library/react';
-import { MemoryRouter, Routes, Route, useLocation } from 'react-router-dom';
+import { MemoryRouter, Routes, Route, Navigate, useLocation } from 'react-router-dom';
vi.mock('../services/api', () => ({
getNotesVaults: vi.fn(),
@@ -24,11 +24,18 @@ function LocationProbe() {
return <div data-testid="location">{loc.pathname + loc.search}</div>;
}
+// Mirrors App.jsx's RedirectWithSearch so the base /wiki redirect keeps ?vault=.
+function RedirectWithSearch({ to }) {
+ const { search, hash } = useLocation();
+ return <Navigate to={`${to}${search}${hash}`} replace />;
+}
+
const renderWiki = (initialEntry) =>
render(
<MemoryRouter initialEntries={[initialEntry]}>
<LocationProbe />
<Routes>
+ <Route path="/wiki" element={<RedirectWithSearch to="/wiki/overview" />} />
<Route path="/wiki/:tab" element={<Wiki />} />
</Routes>
</MemoryRouter>,
@@ -56,6 +63,14 @@ describe('Wiki vault URL wiring', () => {
expect(scanNotesVault).toHaveBeenCalledWith('vault-b', { limit: 1000 });
});
+ it('preserves ?vault= through the base /wiki redirect', async () => {
+ renderWiki('/wiki?vault=vault-b');
+ await waitFor(() =>
+ expect(screen.getByTestId('location')).toHaveTextContent('/wiki/overview?vault=vault-b'),
+ );
+ await waitFor(() => expect(screen.getByTestId('overview')).toHaveTextContent('overview:vault-b'));
+ });
+
it('writes the chosen vault to the URL when selecting from the dropdown', async () => {
renderWiki('/wiki/overview');
await waitFor(() => expect(screen.getByTestId('overview')).toHaveTextContent('overview:vault-a'));