fix(docker): harden frontend runtime config
This commit is contained in:
@@ -13,7 +13,7 @@ beforeEach(() => {
|
||||
test("opens an EventSource and feeds NAMED events to the store", () => {
|
||||
renderHook(() => useSessionStream("s1"));
|
||||
const es = FakeEventSource.instances[0];
|
||||
expect(es.url).toContain("/sessions/s1/events");
|
||||
expect(es.url).toBe("http://localhost:8787/sessions/s1/events");
|
||||
// Backend sends `event: ui_request` (named) — drive the addEventListener path
|
||||
// that production relies on, not the unnamed onmessage fallback.
|
||||
act(() =>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { useEffect, useState } from "react";
|
||||
import { BASE } from "../api/client";
|
||||
import { joinBackendPath } from "../api/runtime-config";
|
||||
import { useSessionStore } from "../store/sessionStore";
|
||||
import type { StreamEvent } from "../api/types";
|
||||
|
||||
@@ -10,7 +11,7 @@ export function useSessionStream(sessionId: string | null) {
|
||||
useEffect(() => {
|
||||
if (!sessionId) return;
|
||||
|
||||
const es = new EventSource(`${BASE}/sessions/${sessionId}/events`);
|
||||
const es = new EventSource(joinBackendPath(BASE, `/sessions/${sessionId}/events`));
|
||||
es.onopen = () => setConnected(true);
|
||||
es.onerror = () => setConnected(false);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user