mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-01-31 06:42:03 +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" {
|
||||
|
||||
@@ -333,7 +333,7 @@ export async function setupProjectWithPath(page: Page, projectPath: string): Pro
|
||||
},
|
||||
worktreesByProject: {},
|
||||
},
|
||||
version: 0,
|
||||
version: 2, // Must match app-store.ts persist version
|
||||
};
|
||||
|
||||
localStorage.setItem("automaker-storage", JSON.stringify(mockState));
|
||||
@@ -346,7 +346,7 @@ export async function setupProjectWithPath(page: Page, projectPath: string): Pro
|
||||
currentStep: "complete",
|
||||
skipClaudeSetup: false,
|
||||
},
|
||||
version: 0,
|
||||
version: 2, // Must match app-store.ts persist version
|
||||
};
|
||||
localStorage.setItem("automaker-setup", JSON.stringify(setupState));
|
||||
}, projectPath);
|
||||
@@ -381,7 +381,7 @@ export async function setupProjectWithPathNoWorktrees(page: Page, projectPath: s
|
||||
currentWorktreeByProject: {},
|
||||
worktreesByProject: {},
|
||||
},
|
||||
version: 0,
|
||||
version: 2, // Must match app-store.ts persist version
|
||||
};
|
||||
|
||||
localStorage.setItem("automaker-storage", JSON.stringify(mockState));
|
||||
@@ -394,7 +394,7 @@ export async function setupProjectWithPathNoWorktrees(page: Page, projectPath: s
|
||||
currentStep: "complete",
|
||||
skipClaudeSetup: false,
|
||||
},
|
||||
version: 0,
|
||||
version: 2, // Must match app-store.ts persist version
|
||||
};
|
||||
localStorage.setItem("automaker-setup", JSON.stringify(setupState));
|
||||
}, projectPath);
|
||||
@@ -433,7 +433,7 @@ export async function setupProjectWithStaleWorktree(page: Page, projectPath: str
|
||||
},
|
||||
worktreesByProject: {},
|
||||
},
|
||||
version: 0,
|
||||
version: 2, // Must match app-store.ts persist version
|
||||
};
|
||||
|
||||
localStorage.setItem("automaker-storage", JSON.stringify(mockState));
|
||||
@@ -446,7 +446,7 @@ export async function setupProjectWithStaleWorktree(page: Page, projectPath: str
|
||||
currentStep: "complete",
|
||||
skipClaudeSetup: false,
|
||||
},
|
||||
version: 0,
|
||||
version: 2, // Must match app-store.ts persist version
|
||||
};
|
||||
localStorage.setItem("automaker-setup", JSON.stringify(setupState));
|
||||
}, projectPath);
|
||||
|
||||
@@ -94,7 +94,7 @@ export async function setupProjectWithFixture(
|
||||
chatHistoryOpen: false,
|
||||
maxConcurrency: 3,
|
||||
},
|
||||
version: 0,
|
||||
version: 2, // Must match app-store.ts persist version
|
||||
};
|
||||
|
||||
localStorage.setItem("automaker-storage", JSON.stringify(mockState));
|
||||
@@ -107,7 +107,7 @@ export async function setupProjectWithFixture(
|
||||
currentStep: "complete",
|
||||
skipClaudeSetup: false,
|
||||
},
|
||||
version: 0,
|
||||
version: 2, // Must match app-store.ts persist version
|
||||
};
|
||||
localStorage.setItem("automaker-setup", JSON.stringify(setupState));
|
||||
}, projectPath);
|
||||
|
||||
@@ -24,7 +24,7 @@ export async function setupMockProject(page: Page): Promise<void> {
|
||||
chatHistoryOpen: false,
|
||||
maxConcurrency: 3,
|
||||
},
|
||||
version: 0,
|
||||
version: 2, // Must match app-store.ts persist version
|
||||
};
|
||||
|
||||
localStorage.setItem("automaker-storage", JSON.stringify(mockState));
|
||||
@@ -57,7 +57,7 @@ export async function setupMockProjectWithConcurrency(
|
||||
chatHistoryOpen: false,
|
||||
maxConcurrency: maxConcurrency,
|
||||
},
|
||||
version: 0,
|
||||
version: 2, // Must match app-store.ts persist version
|
||||
};
|
||||
|
||||
localStorage.setItem("automaker-storage", JSON.stringify(mockState));
|
||||
@@ -101,7 +101,7 @@ export async function setupMockProjectAtConcurrencyLimit(
|
||||
runningAutoTasks: runningTasks,
|
||||
autoModeActivityLog: [],
|
||||
},
|
||||
version: 0,
|
||||
version: 2, // Must match app-store.ts persist version
|
||||
};
|
||||
|
||||
localStorage.setItem("automaker-storage", JSON.stringify(mockState));
|
||||
@@ -152,7 +152,7 @@ export async function setupMockProjectWithFeatures(
|
||||
autoModeActivityLog: [],
|
||||
features: mockFeatures,
|
||||
},
|
||||
version: 0,
|
||||
version: 2, // Must match app-store.ts persist version
|
||||
};
|
||||
|
||||
localStorage.setItem("automaker-storage", JSON.stringify(mockState));
|
||||
@@ -198,7 +198,7 @@ export async function setupMockProjectWithContextFile(
|
||||
chatHistoryOpen: false,
|
||||
maxConcurrency: 3,
|
||||
},
|
||||
version: 0,
|
||||
version: 2, // Must match app-store.ts persist version
|
||||
};
|
||||
|
||||
localStorage.setItem("automaker-storage", JSON.stringify(mockState));
|
||||
@@ -259,7 +259,7 @@ export async function setupMockProjectWithInProgressFeatures(
|
||||
autoModeActivityLog: [],
|
||||
features: mockFeatures,
|
||||
},
|
||||
version: 0,
|
||||
version: 2, // Must match app-store.ts persist version
|
||||
};
|
||||
|
||||
localStorage.setItem("automaker-storage", JSON.stringify(mockState));
|
||||
@@ -297,7 +297,7 @@ export async function setupMockProjectWithView(
|
||||
chatHistoryOpen: false,
|
||||
maxConcurrency: 3,
|
||||
},
|
||||
version: 0,
|
||||
version: 2, // Must match app-store.ts persist version
|
||||
};
|
||||
|
||||
localStorage.setItem("automaker-storage", JSON.stringify(mockState));
|
||||
@@ -321,7 +321,7 @@ export async function setupEmptyLocalStorage(page: Page): Promise<void> {
|
||||
chatHistoryOpen: false,
|
||||
maxConcurrency: 3,
|
||||
},
|
||||
version: 0,
|
||||
version: 2, // Must match app-store.ts persist version
|
||||
};
|
||||
localStorage.setItem("automaker-storage", JSON.stringify(mockState));
|
||||
});
|
||||
@@ -361,7 +361,7 @@ export async function setupMockProjectsWithoutCurrent(
|
||||
chatHistoryOpen: false,
|
||||
maxConcurrency: 3,
|
||||
},
|
||||
version: 0,
|
||||
version: 2, // Must match app-store.ts persist version
|
||||
};
|
||||
|
||||
localStorage.setItem("automaker-storage", JSON.stringify(mockState));
|
||||
@@ -412,7 +412,7 @@ export async function setupMockProjectWithSkipTestsFeatures(
|
||||
autoModeActivityLog: [],
|
||||
features: mockFeatures,
|
||||
},
|
||||
version: 0,
|
||||
version: 2, // Must match app-store.ts persist version
|
||||
};
|
||||
|
||||
localStorage.setItem("automaker-storage", JSON.stringify(mockState));
|
||||
@@ -449,7 +449,7 @@ export async function setupMockMultipleProjects(
|
||||
chatHistoryOpen: false,
|
||||
maxConcurrency: 3,
|
||||
},
|
||||
version: 0,
|
||||
version: 2, // Must match app-store.ts persist version
|
||||
};
|
||||
|
||||
localStorage.setItem("automaker-storage", JSON.stringify(mockState));
|
||||
@@ -490,7 +490,7 @@ export async function setupMockProjectWithAgentOutput(
|
||||
chatHistoryOpen: false,
|
||||
maxConcurrency: 3,
|
||||
},
|
||||
version: 0,
|
||||
version: 2, // Must match app-store.ts persist version
|
||||
};
|
||||
|
||||
localStorage.setItem("automaker-storage", JSON.stringify(mockState));
|
||||
@@ -551,7 +551,7 @@ export async function setupMockProjectWithWaitingApprovalFeatures(
|
||||
autoModeActivityLog: [],
|
||||
features: mockFeatures,
|
||||
},
|
||||
version: 0,
|
||||
version: 2, // Must match app-store.ts persist version
|
||||
};
|
||||
|
||||
localStorage.setItem("automaker-storage", JSON.stringify(mockState));
|
||||
@@ -586,7 +586,7 @@ export async function setupFirstRun(page: Page): Promise<void> {
|
||||
},
|
||||
skipClaudeSetup: false,
|
||||
},
|
||||
version: 0,
|
||||
version: 2, // Must match app-store.ts persist version
|
||||
};
|
||||
|
||||
localStorage.setItem("automaker-setup", JSON.stringify(setupState));
|
||||
@@ -607,7 +607,7 @@ export async function setupFirstRun(page: Page): Promise<void> {
|
||||
autoModeActivityLog: [],
|
||||
currentView: "setup",
|
||||
},
|
||||
version: 0,
|
||||
version: 2, // Must match app-store.ts persist version
|
||||
};
|
||||
|
||||
localStorage.setItem("automaker-storage", JSON.stringify(appState));
|
||||
@@ -627,7 +627,7 @@ export async function setupComplete(page: Page): Promise<void> {
|
||||
currentStep: "complete",
|
||||
skipClaudeSetup: false,
|
||||
},
|
||||
version: 0,
|
||||
version: 2, // Must match app-store.ts persist version
|
||||
};
|
||||
|
||||
localStorage.setItem("automaker-setup", JSON.stringify(setupState));
|
||||
@@ -732,7 +732,7 @@ export async function setupMockProjectWithProfiles(
|
||||
features: [],
|
||||
currentView: "board", // Start at board, will navigate to profiles
|
||||
},
|
||||
version: 0,
|
||||
version: 2, // Must match app-store.ts persist version
|
||||
};
|
||||
|
||||
localStorage.setItem("automaker-storage", JSON.stringify(mockState));
|
||||
@@ -745,7 +745,7 @@ export async function setupMockProjectWithProfiles(
|
||||
currentStep: "complete",
|
||||
skipClaudeSetup: false,
|
||||
},
|
||||
version: 0,
|
||||
version: 2, // Must match app-store.ts persist version
|
||||
};
|
||||
localStorage.setItem("automaker-setup", JSON.stringify(setupState));
|
||||
}, options);
|
||||
|
||||
Reference in New Issue
Block a user