s
This commit is contained in:
@@ -224,6 +224,8 @@ export default function LiveControlApp() {
|
||||
const [showStreamProbes, setShowStreamProbes] = useState(true);
|
||||
const dashboardInFlightRef = useRef<Promise<void> | null>(null);
|
||||
const processMonitorInFlightRef = useRef<Promise<void> | null>(null);
|
||||
const currentProcRef = useRef(currentProc);
|
||||
const urlConfigRequestSeqRef = useRef(0);
|
||||
|
||||
const t = useCallback((zh: string, en: string) => tr(lang, zh, en), [lang]);
|
||||
|
||||
@@ -345,13 +347,20 @@ export default function LiveControlApp() {
|
||||
return () => clearInterval(id);
|
||||
}, [autoRefreshEnabled, refreshProcessMonitor, view]);
|
||||
|
||||
useEffect(() => {
|
||||
currentProcRef.current = currentProc;
|
||||
}, [currentProc]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!currentProc || view !== "live_youtube") return;
|
||||
void (async () => {
|
||||
const targetProc = currentProcRef.current.trim();
|
||||
const requestId = ++urlConfigRequestSeqRef.current;
|
||||
try {
|
||||
const data = await fetchJson<{ content?: string }>(
|
||||
`/get_url_config?process=${encodeURIComponent(currentProc)}`,
|
||||
`/get_url_config?process=${encodeURIComponent(targetProc)}`,
|
||||
);
|
||||
if (requestId !== urlConfigRequestSeqRef.current || targetProc !== currentProcRef.current.trim()) return;
|
||||
setUrlConfig(data.content || "");
|
||||
} catch {
|
||||
/* 保留当前草稿,避免临时读取失败把编辑器清空 */
|
||||
|
||||
Reference in New Issue
Block a user