fix(downloads-ui): editor tail no-op + persisted-tab fallback (+ dead ternary)

Found during the Phase-2 Downloads-frontend review:
- VideoEditor: onLoaded now reconciles the still-pristine full-length segment to the
  REAL decoded duration (its guard `end<=0` was dead since the metadata srcDur is
  always >0). Without this the untouched last segment kept the rounded metadata
  length, so isFullSingle read false and "Create" was enabled on an unmodified
  video — producing a bogus edit that dropped the tail.
- DownloadCenter: fall back to the "queue" tab when a persisted tab (e.g. admin-only
  "system") isn't in the current set, instead of rendering a blank page.
- VideoEditor: reencode = cropOn || accurate (was a no-op `willJoin ? accurate : accurate`).

tsc clean. GUI-affecting → pending an E2E visual test (needs an authed localdev
session) before user UAT. Cross-cutting UI-consistency cleanup deferred to Phase 3.
This commit is contained in:
npeter83 2026-07-11 16:37:57 +02:00
parent aee1bdc85d
commit 94fd7ba9a6
2 changed files with 14 additions and 3 deletions

View file

@ -1,4 +1,4 @@
import { lazy, Suspense, useMemo, useState } from "react";
import { lazy, Suspense, useEffect, useMemo, useState } from "react";
import { useTranslation } from "react-i18next";
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
import {
@ -586,6 +586,12 @@ export default function DownloadCenter({ me }: { me: Me }) {
{ id: "shared", label: t("downloads.tabs.shared") },
...(me.role === "admin" ? [{ id: "system", label: t("downloads.tabs.system") }] : []),
];
// A persisted tab can point at one no longer available (e.g. "system" restored for a now-non-admin
// account) — that would render a blank page with no active tab. Fall back to the default.
useEffect(() => {
if (!tabs.some((tb) => tb.id === tab)) setTab("queue");
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [tab, me.role]);
const saveBtn = (job: DownloadJob) => (
<a