Skip to content

Commit 12d1179

Browse files
committed
always boot to the new task page
1 parent e29164a commit 12d1179

1 file changed

Lines changed: 0 additions & 31 deletions

File tree

packages/ui/src/router/router.ts

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,6 @@ import { RoutePending } from "./RoutePending";
77
import { setRouter } from "./routerRef";
88
import { routeTree } from "./routeTree.gen";
99

10-
const LAST_ROUTE_KEY = "code:last-route-hash";
11-
12-
// Cold-boot URL restore: Electron's BrowserWindow.loadFile resets the URL
13-
// hash, so a quit + relaunch loses the user's last route. localStorage is
14-
// sync, so we can read the persisted hash before the router parses location.
15-
// Without this the user sees a TaskInput flash before the route hydrates.
16-
if (typeof window !== "undefined" && !window.location.hash) {
17-
try {
18-
const last = window.localStorage.getItem(LAST_ROUTE_KEY);
19-
if (last && last !== "#" && last !== "#/") {
20-
window.location.hash = last;
21-
}
22-
} catch {
23-
// localStorage may throw in restricted contexts; safe to ignore.
24-
}
25-
}
26-
2710
export const router = createTanStackRouter({
2811
routeTree,
2912
history: createHashHistory(),
@@ -40,20 +23,6 @@ export const router = createTanStackRouter({
4023
// static import of this module (which would re-create the route-tree cycle).
4124
setRouter(router);
4225

43-
// Persist current hash on every navigation so we can restore it next boot.
44-
if (typeof window !== "undefined") {
45-
router.subscribe("onResolved", () => {
46-
try {
47-
const hash = window.location.hash;
48-
if (hash && hash !== "#" && hash !== "#/") {
49-
window.localStorage.setItem(LAST_ROUTE_KEY, hash);
50-
}
51-
} catch {
52-
// Ignore localStorage failures.
53-
}
54-
});
55-
}
56-
5726
declare module "@tanstack/react-router" {
5827
interface Register {
5928
router: typeof router;

0 commit comments

Comments
 (0)