Skip to content
Merged
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
20 changes: 20 additions & 0 deletions e2e/vue-start/server-routes/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
node_modules
package-lock.json
yarn.lock

.DS_Store
.cache
.env
.vercel
.output

/build/
/api/
/server/build
/public/build
# Sentry Config File
.env.sentry-build-plugin
/test-results/
/playwright-report/
/blob-report/
/playwright/.cache/
4 changes: 4 additions & 0 deletions e2e/vue-start/server-routes/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
**/build
**/public
pnpm-lock.yaml
routeTree.gen.ts
42 changes: 42 additions & 0 deletions e2e/vue-start/server-routes/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"name": "tanstack-vue-start-e2e-server-routes",
"private": true,
"sideEffects": false,
"type": "module",
"scripts": {
"dev": "vite dev --port 3000",
"dev:e2e": "vite dev",
"build": "vite build && tsc --noEmit",
"preview": "vite preview",
"start": "pnpx srvx --prod -s ../client dist/server/server.js",
"test:e2e": "playwright test --project=chromium"
},
"dependencies": {
"@tanstack/vue-query": "^5.90.9",
"@tanstack/vue-router": "workspace:^",
"@tanstack/vue-router-devtools": "workspace:^",
"@tanstack/vue-router-ssr-query": "workspace:^",
"@tanstack/vue-start": "workspace:^",
Comment on lines +16 to +19
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Use workspace:* protocol for internal dependencies.

Internal TanStack packages currently use workspace:^ but the coding guidelines specify using workspace:* for workspace dependencies. This ensures exact version matching across the monorepo.

Apply this diff to align with project conventions:

   "dependencies": {
     "@tanstack/vue-query": "^5.90.9",
-    "@tanstack/vue-router": "workspace:^",
-    "@tanstack/vue-router-devtools": "workspace:^",
-    "@tanstack/vue-router-ssr-query": "workspace:^",
-    "@tanstack/vue-start": "workspace:^",
+    "@tanstack/vue-router": "workspace:*",
+    "@tanstack/vue-router-devtools": "workspace:*",
+    "@tanstack/vue-router-ssr-query": "workspace:*",
+    "@tanstack/vue-start": "workspace:*",
     "js-cookie": "^3.0.5",
     "redaxios": "^0.5.1",
   "devDependencies": {
     "@playwright/test": "^1.50.1",
     "@tailwindcss/postcss": "^4.1.15",
-    "@tanstack/router-e2e-utils": "workspace:^",
+    "@tanstack/router-e2e-utils": "workspace:*",
     "@types/js-cookie": "^3.0.6",

As per coding guidelines for workspace dependencies.

Also applies to: 30-30

🤖 Prompt for AI Agents
In e2e/vue-start/server-routes/package.json around lines 16 to 19 (and also line
30), the internal TanStack dependencies use the "workspace:^" protocol; change
them to use "workspace:*" to follow project conventions. Edit each workspace
dependency entry (e.g., "@tanstack/vue-router", "@tanstack/vue-router-devtools",
"@tanstack/vue-router-ssr-query", "@tanstack/vue-start") and replace the version
specifier "workspace:^" with "workspace:*" so internal packages resolve to the
exact workspace versions.

"js-cookie": "^3.0.5",
"redaxios": "^0.5.1",
"tailwind-merge": "^2.6.0",
"vite": "^7.1.7",
"vue": "^3.5.25",
"zod": "^3.24.2"
},
"devDependencies": {
"@playwright/test": "^1.50.1",
"@tailwindcss/postcss": "^4.1.15",
"@tanstack/router-e2e-utils": "workspace:^",
"@types/js-cookie": "^3.0.6",
"@types/node": "^22.10.2",
"combinate": "^1.1.11",
"postcss": "^8.5.1",
"srvx": "^0.8.6",
"tailwindcss": "^4.1.17",
"typescript": "^5.7.2",
"@vitejs/plugin-vue": "^6.0.3",
"@vitejs/plugin-vue-jsx": "^5.1.2",
"vite-tsconfig-paths": "^5.1.4"
}
}
35 changes: 35 additions & 0 deletions e2e/vue-start/server-routes/playwright.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { defineConfig, devices } from '@playwright/test'
import { getTestServerPort } from '@tanstack/router-e2e-utils'
import packageJson from './package.json' with { type: 'json' }

export const PORT = await getTestServerPort(packageJson.name)
const baseURL = `http://localhost:${PORT}`

/**
* See https://playwright.dev/docs/test-configuration.
*/
export default defineConfig({
testDir: './tests',
workers: 1,

reporter: [['line']],

use: {
/* Base URL to use in actions like `await page.goto('/')`. */
baseURL,
},

webServer: {
command: `pnpm build && VITE_SERVER_PORT=${PORT} PORT=${PORT} pnpm start`,
url: baseURL,
reuseExistingServer: !process.env.CI,
stdout: 'pipe',
},

projects: [
{
name: 'chromium',
use: { ...devices['Desktop Chrome'] },
},
],
})
5 changes: 5 additions & 0 deletions e2e/vue-start/server-routes/postcss.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export default {
plugins: {
'@tailwindcss/postcss': {},
},
}
Binary file added e2e/vue-start/server-routes/public/favicon.ico
Binary file not shown.
Binary file added e2e/vue-start/server-routes/public/favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import {
ErrorComponent,
Link,
rootRouteId,
useMatch,
useRouter,
} from '@tanstack/vue-router'
import type { ErrorComponentProps } from '@tanstack/vue-router'

export function DefaultCatchBoundary({ error }: ErrorComponentProps) {
const router = useRouter()
const isRoot = useMatch({
strict: false,
select: (state) => state.id === rootRouteId,
})

console.error(error)

return (
<div class="min-w-0 flex-1 p-4 flex flex-col items-center justify-center gap-6">
<ErrorComponent error={error} />
<div class="flex gap-2 items-center flex-wrap">
<button
onClick={() => {
router.invalidate()
}}
class={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}
>
Try Again
</button>
{isRoot.value ? (
<Link
to="/"
class={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}
>
Home
</Link>
) : (
<Link
to="/"
class={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}
onClick={(e: MouseEvent) => {
e.preventDefault()
window.history.back()
}}
>
Go Back
</Link>
Comment on lines +39 to +48
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Misleading to prop on "Go Back" link.

The Go Back link specifies to="/" but prevents default navigation and calls window.history.back() instead. The to prop is misleading since the link doesn't actually navigate to the root route.

Consider refactoring to use a button element instead:

-        <Link
-          to="/"
-          class={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}
-          onClick={(e: MouseEvent) => {
-            e.preventDefault()
-            window.history.back()
-          }}
-        >
-          Go Back
-        </Link>
+        <button
+          onClick={() => {
+            window.history.back()
+          }}
+          class={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}
+        >
+          Go Back
+        </button>

This makes the intent clearer and avoids the misleading to prop.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<Link
to="/"
class={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}
onClick={(e: MouseEvent) => {
e.preventDefault()
window.history.back()
}}
>
Go Back
</Link>
<button
onClick={() => {
window.history.back()
}}
class={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}
>
Go Back
</button>
🤖 Prompt for AI Agents
In e2e/vue-start/server-routes/src/components/DefaultCatchBoundary.tsx around
lines 39 to 48, the Link uses a misleading to="/" prop while preventing default
and calling window.history.back(); replace the Link with a semantic <button>
element (type="button") using the same className/styles and keep the onClick
handler that calls window.history.back() so no navigation prop is present and
intent is clear; remove the to prop and any Link-specific imports if no longer
used.

)}
</div>
</div>
)
}
25 changes: 25 additions & 0 deletions e2e/vue-start/server-routes/src/components/NotFound.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { Link } from '@tanstack/vue-router'

export function NotFound({ children }: { children?: any }) {
return (
<div class="space-y-2 p-2" data-testid="default-not-found-component">
<div class="text-gray-600 dark:text-gray-400">
{children || <p>The page you are looking for does not exist.</p>}
</div>
<p class="flex items-center gap-2 flex-wrap">
<button
onClick={() => window.history.back()}
class="bg-emerald-500 text-white px-2 py-1 rounded-sm uppercase font-black text-sm"
>
Go back
</button>
<Link
to="/"
class="bg-cyan-600 text-white px-2 py-1 rounded-sm uppercase font-black text-sm"
>
Start Over
</Link>
</p>
</div>
)
}
Loading