refactor: move decision listener URL from build-time env var to runtime config#6
Conversation
…me config Replaces the hard-coded `NEXT_PUBLIC_DECISION_LISTENER_URL` environment variable usage across all components with the centralized runtime config system (`useRuntimeConfig` hook). This ensures the decision listener URL is fetched from the server at runtime (via `/api/config`) rather than baked in at build time, consistent with how `wsUrl` and `apiUrl` are already handled.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c399f1388d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
|
||
| export function DecisionsPanel({ meetingId, isActive, embedded }: DecisionsPanelProps) { | ||
| const { config } = useRuntimeConfig(); | ||
| const decisionListenerUrl = config?.decisionListenerUrl ?? "http://localhost:8765"; |
There was a problem hiding this comment.
Block panel network calls until runtime config loads
Because useRuntimeConfig() starts with config === null on cold loads, this fallback URL is always used on first render; the panel then immediately runs its history fetch and SSE connect against http://localhost:8765 before /api/config resolves. In environments where the real listener URL is not localhost, users will make wrong-host requests (to their own machine) and can see flaky initial panel state; this should be gated on runtime-config readiness the same way tracker/page.tsx does.
Useful? React with 👍 / 👎.
| participants, | ||
| }: MeetingAnthologyProps) { | ||
| const { config } = useRuntimeConfig(); | ||
| const decisionListenerUrl = config?.decisionListenerUrl ?? "http://localhost:8765"; |
There was a problem hiding this comment.
Block anthology network calls until runtime config loads
This fallback causes MeetingAnthology to hit http://localhost:8765 during the first render while runtime config is still loading, and its effects then start /decisions/.../all, SSE, and summary traffic against that wrong host before switching later. When the configured listener URL differs from localhost, this creates deterministic bad requests and transiently incorrect/empty data; the effects should wait until runtime config is resolved.
Useful? React with 👍 / 👎.
|
Hey! This repo has been archived — the dashboard has moved to the monorepo at https://github.com/Vexa-ai/vexa under We're pulling your changes into the monorepo now to preserve your commits. Future PRs should be submitted to https://github.com/Vexa-ai/vexa. Thanks for the contribution! |
Replaces the hard-coded
NEXT_PUBLIC_DECISION_LISTENER_URLenvironment variable usage across all components with the centralized runtime config system (useRuntimeConfighook). This ensures the decision listener URL is fetched from the server at runtime (via/api/config) rather than baked in at build time, consistent with howwsUrlandapiUrlare already handled.Changes
src/app/api/config/route.tsdecisionListenerUrlto the runtime config API response, sourced fromNEXT_PUBLIC_DECISION_LISTENER_URLenv var (defaults tohttp://localhost:8765).src/hooks/use-runtime-config.tsdecisionListenerUrlfield to theRuntimeConfiginterface.getDecisionListenerUrl()synchronous helper (mirrors existinggetWsUrl()/getApiUrl()pattern).src/app/tracker/page.tsxDECISION_LISTENER_URLconstant.useRuntimeConfig()hook to obtain the URL at runtime.fetchConfigwithisRuntimeConfigLoadingto avoid fetching before the URL is available.useCallbackdependency arrays accordingly.src/components/anthology/entity-chip.tsxDECISION_LISTENER_URLconstant.useRuntimeConfig()hook; derivesdecisionListenerUrlfrom config.useCallbackdeps.src/components/anthology/meeting-anthology.tsxDECISION_LISTENER_URLconstant.useRuntimeConfig()hook for decision listener URL.load,connectSSE,fetchSummary).src/components/decisions/decisions-panel.tsxDECISION_LISTENER_URLconstant.useRuntimeConfig()hook for decision listener URL.Motivation
DECISION_LISTENER_URLconstants scattered across components.Files Changed (6)
src/app/api/config/route.tsdecisionListenerUrlin config APIsrc/hooks/use-runtime-config.tssrc/app/tracker/page.tsxsrc/components/anthology/entity-chip.tsxsrc/components/anthology/meeting-anthology.tsxsrc/components/decisions/decisions-panel.tsxTest Plan
/api/configresponse includesdecisionListenerUrlhttp://localhost:8765works when env var is not set