From fc338431796b4c8a457644b3c43378ca564c83a9 Mon Sep 17 00:00:00 2001 From: Moepchi Date: Mon, 30 Nov 2026 22:13:41 +0000 Subject: [PATCH] web: pop-out window opens channel streams by itself While the stream grid is popped out, every stream in our channel is watched right away instead of showing a "Watch" tile. Each stream is auto-opened only once, so closing it or a refused join request leaves the tile rather than rejoining in a loop. The main window still waits for a click. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Hu2cuPLqpuKVfd9wWFFakU --- web/src/App.tsx | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/web/src/App.tsx b/web/src/App.tsx index 60ab22b..712c74c 100644 --- a/web/src/App.tsx +++ b/web/src/App.tsx @@ -9074,6 +9074,8 @@ function AppInner() { /** Keyed by stream id: one client can send screen and camera at once. */ const [watchedStreams, setWatchedStreams] = useState>({}); const streamViewersRef = useRef>(new Map()); + /** Streams the pop-out already opened by itself; closed or refused ones are not retried. */ + const autoWatchedRef = useRef>(new Set()); /** Tile shown across the whole grid, Discord's "focus" (clid, or -1 for our own broadcast). */ const [focusedStream, setFocusedStream] = useState(null); /** Separate browser window the stream grid is portalled into, if popped out. */ @@ -12294,6 +12296,20 @@ function AppInner() { viewer.join(); }; + // Popped out, the window is meant for watching: open channel streams right + // away. Only once per stream, so closing one (or a refused join request) + // leaves a tile to click instead of reopening it in a loop. + const availableStreamIds = availableStreams.map((info) => info.id).join(","); + useEffect(() => { + if (!streamPopout) return; + for (const info of availableStreams) { + if (autoWatchedRef.current.has(info.id)) continue; + autoWatchedRef.current.add(info.id); + handleWatchStream(info.id); + } + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [streamPopout, availableStreamIds]); + /** Stops one broadcast, or all of them without a source. */ const handleStopPublishing = (source?: PublishSource) => { const publishers = publishersRef.current;