mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-01-31 20:03:37 +00:00
fix: use browser history in web mode for proper URL routing
The router was using memory history with initial entry "/" which caused all routes to render the index component regardless of the browser URL. Changes: - Use browser history when not in Electron (for e2e tests and dev) - Use memory history only in Electron environment - Update test utilities to use persist version 2 to match app store This fixes e2e tests that navigate directly to /board, /context, /spec 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,10 +1,17 @@
|
||||
import { createRouter, createMemoryHistory } from "@tanstack/react-router";
|
||||
import { createRouter, createMemoryHistory, createBrowserHistory } from "@tanstack/react-router";
|
||||
import { routeTree } from "../routeTree.gen";
|
||||
|
||||
// Use browser history in web mode (for e2e tests and dev), memory history in Electron
|
||||
const isElectron = typeof window !== "undefined" && window.electronAPI !== undefined;
|
||||
|
||||
const history = isElectron
|
||||
? createMemoryHistory({ initialEntries: [window.location.pathname || "/"] })
|
||||
: createBrowserHistory();
|
||||
|
||||
export const router = createRouter({
|
||||
routeTree,
|
||||
defaultPendingMinMs: 0,
|
||||
history: createMemoryHistory({ initialEntries: ["/"] }),
|
||||
history,
|
||||
});
|
||||
|
||||
declare module "@tanstack/react-router" {
|
||||
|
||||
Reference in New Issue
Block a user