Hardcode observer basepath, Use SDK useDMs; remove workspace DM API and hook#69
Hardcode observer basepath, Use SDK useDMs; remove workspace DM API and hook#69willwashburn merged 3 commits intomainfrom
Conversation
Remove the dynamic basePath handling and hardcode the app to run under /observer. Deleted the withBasePath helper and replaced its usages with explicit "/observer" prefixes (assets and API routes). Also set next.config.js basePath to "/observer", removed the base-path input from the deploy action and workflow, and updated preview workflow checks/messages to include the /observer path. This simplifies routing for deployments served under /observer but requires ensuring the site and API are hosted at that base path.
Replace the local workspace DM implementation with the SDK-provided useDMs hook. Deleted the server API route (src/app/api/dms/route.ts) and the client hook (src/hooks/use-workspace-dms.ts) that previously fetched workspace DMs and handled websocket DM events, and updated DashboardLayout to import useDMs from @relaycast/react instead of the removed hook. This consolidates DM handling onto the SDK hook and removes the custom workspace-level endpoint and related update logic.
There was a problem hiding this comment.
Pull request overview
This PR standardizes the observer dashboard’s routing by hardcoding the Next.js basePath to /observer, removes the previously dynamic base path plumbing, and simplifies DM data-fetching by switching from a custom workspace DM endpoint/hook to the SDK’s useDMs hook.
Changes:
- Hardcode
basePath: "/observer"and replace allwithBasePath(...)usages with explicit/observer/...paths. - Remove the custom workspace DM API route and
useWorkspaceDMshook; useuseDMsfrom@relaycast/reactinstead. - Update preview/deploy workflows and the deploy composite action to align URLs and remove
base-pathinputs.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| packages/observer-dashboard/next.config.js | Hardcodes Next.js basePath to /observer. |
| packages/observer-dashboard/src/lib/basePath.ts | Removes dynamic basePath helper. |
| packages/observer-dashboard/src/lib/auth.ts | Updates auth fetches to /observer/api/.... |
| packages/observer-dashboard/src/components/RelaySessionProvider.tsx | Updates session check fetch path to /observer/api/.... |
| packages/observer-dashboard/src/components/DashboardLayout.tsx | Switches DMs source to useDMs; updates workspace stream API path. |
| packages/observer-dashboard/src/components/ChatFeed.tsx | Updates DM messages fetch path to /observer/api/.... |
| packages/observer-dashboard/src/components/AgentSidebar.tsx | Updates logo asset paths to /observer/brand/.... |
| packages/observer-dashboard/src/app/login/page.tsx | Updates logo asset paths to /observer/brand/.... |
| packages/observer-dashboard/src/hooks/use-workspace-dms.ts | Removes custom workspace DM hook. |
| packages/observer-dashboard/src/app/api/dms/route.ts | Removes custom /api/dms endpoint. |
| .github/workflows/preview.yml | Updates observer preview URL checks/comments to include /observer. |
| .github/workflows/deploy.yml | Removes base-path input to deploy action. |
| .github/actions/deploy-observer-dashboard/action.yml | Removes base-path input/env wiring. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| /** @type {import('next').NextConfig} */ | ||
| const nextConfig = { | ||
| basePath: process.env.NEXT_PUBLIC_BASE_PATH || "", | ||
| basePath: "/observer", |
There was a problem hiding this comment.
Hardcoding Next.js basePath to /observer means requests to the observer hostname root (/) will 404 unless something upstream rewrites/redirects to /observer. The current observer-router worker forwards incoming.pathname unchanged, so it will pass / through to Pages unchanged. Consider adding an explicit redirect/rewrite for / (and possibly any non-/observer/* path) either in the observer-router worker or via a Next.js redirects() rule so the dashboard remains reachable at the bare hostname.
| basePath: "/observer", | |
| basePath: "/observer", | |
| async redirects() { | |
| return [ | |
| { | |
| source: "/", | |
| destination: "/observer", | |
| permanent: false, | |
| }, | |
| ]; | |
| }, |
|
Preview deployed!
This preview shares the staging database and will be cleaned up when the PR is merged or closed. Run E2E testsnpm run e2e -- https://pr69-api.relaycast.dev --ciOpen observer dashboard |
Delete multiple Next.js edge API route handlers for the observer dashboard (activity, bridge, DM messages, spawned, workspace/stream) and update UI components to use the client Relay SDK directly. ChatFeed now uses useRelay().dmMessages instead of fetching /observer/api/dms, and DashboardLayout uses useRelay() to fetch workspace DMs, subscribe to DM events, and call relay.workspace.stream.get/set for stream status and toggling. Also add conversion helper for DM conversation summaries and adjust types/imports accordingly.
This pull request simplifies the handling of the Next.js
basePathfor the observer dashboard by hardcoding it to/observerand removing all dynamic or environment-based path logic. It eliminates thewithBasePathutility and updates all code to use the/observerprefix directly. Additionally, it removes the custom DMs API hook and endpoint in favor of built-in hooks from the@relaycast/reactlibrary, and makes minor workflow adjustments to reflect the new path structure.Base path handling simplification:
basePathto'/observer'innext.config.js, removing the need for dynamic or environment-based path configuration. (packages/observer-dashboard/next.config.js)withBasePathutility and all its usages throughout the codebase, replacing them with direct/observerpaths in API calls and asset references. (packages/observer-dashboard/src/lib/basePath.ts, multiple files) [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14]API and data fetching improvements:
/api/dmsendpoint and theuseWorkspaceDMshook, switching to the standarduseDMshook from@relaycast/reactfor direct DM conversation data. (packages/observer-dashboard/src/app/api/dms/route.ts,packages/observer-dashboard/src/hooks/use-workspace-dms.ts,packages/observer-dashboard/src/components/DashboardLayout.tsx) [1] [2] [3]Workflow and deployment updates:
base-pathinput and ensure all preview and production URLs include the/observerprefix. (.github/actions/deploy-observer-dashboard/action.yml,.github/workflows/deploy.yml,.github/workflows/preview.yml) [1] [2] [3] [4] [5]These changes make the observer dashboard's routing and deployment more predictable and maintainable by standardizing on the
/observerpath and removing unnecessary indirection.