Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions apps/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"@t3tools/secret-provider-onepassword": "workspace:*",
"@t3tools/shared": "workspace:*",
"@tanstack/react-pacer": "^0.19.4",
"@tanstack/react-router": "^1.160.2",
"@tanstack/react-router": "^1.170.46",
"@tiptap/core": "^3.31.3",
"@tiptap/extension-blockquote": "^3.31.3",
"@tiptap/extension-bold": "^3.31.3",
Expand Down Expand Up @@ -93,7 +93,7 @@
"@effect/platform-node": "catalog:",
"@effect/vitest": "catalog:",
"@tailwindcss/vite": "^4.0.0",
"@tanstack/router-plugin": "^1.161.0",
"@tanstack/router-plugin": "^1.169.0",
"@types/canvas-confetti": "1.9.0",
"@types/compression": "^1.8.1",
"@types/culori": "^4.0.1",
Expand Down
16 changes: 3 additions & 13 deletions apps/web/src/components/settings/settingsScopeNavigation.test.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
import { EnvironmentId, ProviderInstanceId, ScheduledTaskId } from "@t3tools/contracts";
import {
createMemoryHistory,
createRootRoute,
createRoute,
createRouter,
redirect,
} from "@tanstack/react-router";
import { createRootRoute, createRoute, createRouter, redirect } from "@tanstack/react-router";
import { describe, expect, it } from "vite-plus/test";
import { testMemoryRouterOptions } from "../../../test/memoryRouter";

import { resolveSettingsScope } from "./settingsScope";
import { retainSettingsScope, validateSettingsRouteSearch } from "./settingsScopeNavigation";
Expand Down Expand Up @@ -76,7 +71,7 @@ function createSettingsRouter(initialEntry = "/settings/general") {
]),
legacyProject,
]),
history: createMemoryHistory({ initialEntries: [initialEntry] }),
...testMemoryRouterOptions(initialEntry),
});
}

Expand Down Expand Up @@ -122,7 +117,6 @@ describe("settings scope navigation", () => {
});
expect(router.state.location.pathname).toBe(to);
expect(router.state.location.search).toEqual(regroupedCheckout);
expect(router.state.redirect).toBeUndefined();

await router.navigate({
from: "/settings",
Expand Down Expand Up @@ -220,17 +214,13 @@ describe("settings scope navigation", () => {
to: "/projects/$projectKey",
params: { projectKey: "legacy-project" },
});
expect(router.state.redirect).not.toBeUndefined();
await router.navigate(router.state.redirect!.options);
expect(router.state.location.pathname).toBe("/settings/projects");
expect(router.state.location.search).toEqual({ project: "legacy-project" });
});

it("keeps scope through the settings index redirect", async () => {
const router = createSettingsRouter();
await router.navigate({ to: "/settings", search: { machine: "remote-server" } });
expect(router.state.redirect).not.toBeUndefined();
await router.navigate(router.state.redirect!.options);
expect(router.state.location.pathname).toBe("/settings/general");
expect(router.state.location.search).toEqual({ machine: "remote-server" });
});
Expand Down
10 changes: 3 additions & 7 deletions apps/web/src/lib/assistantCitationNavigation.test.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
import { EnvironmentId, MessageId, ThreadId, type AssistantCitation } from "@t3tools/contracts";
import {
createMemoryHistory,
createRootRoute,
createRoute,
createRouter,
} from "@tanstack/react-router";
import { createRootRoute, createRoute, createRouter } from "@tanstack/react-router";
import { scopeThreadRef } from "@t3tools/client-runtime/environment";
import { describe, expect, it } from "vite-plus/test";
import { testMemoryRouterOptions } from "../../test/memoryRouter";

import { selectActiveRightPanelSurface, useRightPanelStore } from "../rightPanelStore";
import {
Expand All @@ -32,7 +28,7 @@ function createCitationRouter(initialEntry = "/environment-one/thread-one") {
const thread = createRoute({ getParentRoute: () => root, path: "/$environmentId/$threadId" });
return createRouter({
routeTree: root.addChildren([thread]),
history: createMemoryHistory({ initialEntries: [initialEntry] }),
...testMemoryRouterOptions(initialEntry),
});
}

Expand Down
1,254 changes: 627 additions & 627 deletions apps/web/src/routeTree.gen.ts

Large diffs are not rendered by default.

10 changes: 3 additions & 7 deletions apps/web/src/threadRoutes.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
import {
createMemoryHistory,
createRootRoute,
createRoute,
createRouter,
} from "@tanstack/react-router";
import { createRootRoute, createRoute, createRouter } from "@tanstack/react-router";
import { describe, expect, it } from "vite-plus/test";
import { scopeThreadRef } from "@t3tools/client-runtime/environment";
import { EMPTY_ENVIRONMENT_THREAD_STATE } from "@t3tools/client-runtime/state/threads";
Expand All @@ -12,6 +7,7 @@ import * as DateTime from "effect/DateTime";
import * as Option from "effect/Option";
import { linkedThreadRouteParams } from "./linkedThreadSurface";
import { makeThreadProjectionFixture } from "./test-fixtures";
import { testMemoryRouterOptions } from "../test/memoryRouter";

import {
isThreadRoutePathname,
Expand Down Expand Up @@ -56,7 +52,7 @@ describe("threadRoutes", () => {
const newThread = createRoute({ getParentRoute: () => root, path: "new" });
const router = createRouter({
routeTree: root.addChildren([thread, newThread]),
history: createMemoryHistory({ initialEntries: ["/new"] }),
...testMemoryRouterOptions("/new"),
});
await router.load();
const ref = scopeThreadRef("local" as never, ThreadId.make("mcp:example"));
Expand Down
11 changes: 11 additions & 0 deletions apps/web/test/memoryRouter.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { createMemoryHistory } from "@tanstack/react-router";

/** Spread into `createRouter` for a memory router in Node tests that navigate. */
export function testMemoryRouterOptions(initialEntry: string) {
return {
history: createMemoryHistory({ initialEntries: [initialEntry] }),
// Without a document the router runs as SSR, where navigate is a no-op.
isServer: false,
origin: "http://localhost",
} as const;
}
Loading