fix youtube single pro lane switch

This commit is contained in:
eric 2026-06-03 23:09:04 -05:00
parent 2ed34b6662
commit d94c434b1f

View File

@ -914,6 +914,10 @@ export function LiveYoutubeUnmannedView({
}, [channels, activeCh]); }, [channels, activeCh]);
const active = channels.find((c) => c.id === activeCh) || channels[0]; const active = channels.find((c) => c.id === activeCh) || channels[0];
const currentProcChannel = useMemo(
() => channels.find((c) => resolveChannelPm2(c) === currentProc),
[channels, currentProc],
);
const rowForPm2 = useCallback((pm2: string) => liveProcesses.find((p) => p.pm2 === pm2), [liveProcesses]); const rowForPm2 = useCallback((pm2: string) => liveProcesses.find((p) => p.pm2 === pm2), [liveProcesses]);
const statusForPm2 = useCallback( const statusForPm2 = useCallback(
(pm2: string) => rowForPm2(pm2)?.process_status, (pm2: string) => rowForPm2(pm2)?.process_status,
@ -925,7 +929,7 @@ export function LiveYoutubeUnmannedView({
const runtimeLogRow = rowForPm2(runtimeLogProc); const runtimeLogRow = rowForPm2(runtimeLogProc);
useEffect(() => { useEffect(() => {
if (mode !== "single" || !preferredSingleProc) return; if (mode !== "single" || !preferredSingleProc) return;
if (!currentProc || isYoutubeProPm2(currentProc)) { if (!currentProc) {
currentProcRef.current = preferredSingleProc; currentProcRef.current = preferredSingleProc;
setCurrentProc(preferredSingleProc); setCurrentProc(preferredSingleProc);
} }
@ -1241,7 +1245,8 @@ export function LiveYoutubeUnmannedView({
} }
if (m === "single") { if (m === "single") {
const current = currentProcRef.current.trim(); const current = currentProcRef.current.trim();
const target = current && !isYoutubeProPm2(current) ? current : preferredSingleProc || singleProcessOptions[0]?.pm2 || ""; const activePm2 = active ? resolveChannelPm2(active) : "";
const target = mode === "pro" ? activePm2 || current : current || preferredSingleProc || singleProcessOptions[0]?.pm2 || "";
if (target) { if (target) {
currentProcRef.current = target; currentProcRef.current = target;
setCurrentProc(target); setCurrentProc(target);
@ -1270,6 +1275,7 @@ export function LiveYoutubeUnmannedView({
[ [
channels, channels,
applyProUrlDraft, applyProUrlDraft,
active,
activeCh, activeCh,
mode, mode,
notify, notify,
@ -2606,7 +2612,7 @@ export function LiveYoutubeUnmannedView({
> >
{currentProc && !singleProcessOptions.some((entry) => entry.pm2 === currentProc) ? ( {currentProc && !singleProcessOptions.some((entry) => entry.pm2 === currentProc) ? (
<option value={currentProc}> <option value={currentProc}>
{currentProc} {currentProcChannel ? `${currentProcChannel.name || currentProcChannel.id} (${currentProc})` : currentProc}
{currentProcRow ? ` (${businessStatusLabel(currentProcRow, t)})` : ""} {currentProcRow ? ` (${businessStatusLabel(currentProcRow, t)})` : ""}
</option> </option>
) : null} ) : null}