-
Notifications
You must be signed in to change notification settings - Fork 172
Real 404 pages and per-route document titles #1261
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| import { useEffect } from "react"; | ||
|
|
||
| const APP_NAME = "Executor"; | ||
|
|
||
| export function executorDocumentTitle(page: string): string { | ||
| return `${page} · ${APP_NAME}`; | ||
| } | ||
|
|
||
| export function useExecutorDocumentTitle(page: string | null | undefined): void { | ||
| useEffect(() => { | ||
| if (!page || typeof document === "undefined") return; | ||
| document.title = executorDocumentTitle(page); | ||
| }, [page]); | ||
|
Comment on lines
+9
to
+13
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The hook sets |
||
| } | ||
|
Comment on lines
+1
to
+14
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The file contains no JSX — it only imports Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time! |
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -33,6 +33,7 @@ import { usePolicyActions } from "../hooks/use-policy-actions"; | |||||
| import { useIntegrationPlugins, type IntegrationAccountHandoff } from "@executor-js/sdk/client"; | ||||||
| import { Button } from "../components/button"; | ||||||
| import { Skeleton } from "../components/skeleton"; | ||||||
| import { useExecutorDocumentTitle } from "../lib/document-title"; | ||||||
|
|
||||||
| // v2: the route's `namespace` param is the integration slug. Tools belong to | ||||||
| // the integration's per-owner connections; a tool's policy id is | ||||||
|
|
@@ -97,6 +98,7 @@ export function IntegrationDetailPage(props: { namespace: string }) { | |||||
| }, [namespace]); | ||||||
|
|
||||||
| const integrationData = AsyncResult.isSuccess(integration) ? integration.value : null; | ||||||
| useExecutorDocumentTitle(integrationData?.name || namespace); | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time! |
||||||
| const isBuiltInIntegration = namespace === "executor" || integrationData?.kind === "built-in"; | ||||||
| const currentTab = isBuiltInIntegration ? "tools" : activeTab; | ||||||
| const canRefresh = integrationData?.canRefresh ?? false; | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,12 +1,14 @@ | ||
| import { createFileRoute, useParams } from "@tanstack/react-router"; | ||
|
|
||
| import { ToolkitsPluginRoute } from "./toolkits-route"; | ||
| import { useExecutorDocumentTitle } from "../lib/document-title"; | ||
|
|
||
| export const Route = createFileRoute("/{-$orgSlug}/toolkits")({ | ||
| component: ToolkitsRouteComponent, | ||
| }); | ||
|
|
||
| function ToolkitsRouteComponent() { | ||
| useExecutorDocumentTitle("Toolkits"); | ||
| const { toolkitSlug } = useParams({ strict: false }) as { toolkitSlug?: string }; | ||
| return <ToolkitsPluginRoute toolkitSlug={toolkitSlug} />; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NotFoundPageis duplicated verbatim across two root filesThe identical component exists in both
packages/app/src/routes/__root.tsxandapps/host-selfhost/web/routes/__root.tsx. Any future copy/style change will need to be made in both places. AGENTS.md recommends keeping package boundaries clear and extracting shared logic when the behavior is genuinely shared — this is a good candidate. A single export frompackages/react(e.g. alongside the other page components) would keep both roots in sync automatically.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!