From 455735655f4108f6964ef7e71e1acb0078cda555 Mon Sep 17 00:00:00 2001 From: Quick104 <31828688+Quick104@users.noreply.github.com> Date: Fri, 20 Nov 2026 19:43:07 -0500 Subject: [PATCH 1/7] fix(web): lock a wizard subtitle provider after a failed save until it is reloaded After a provider save failed, the setup wizard's Subtitles step reloaded the editor and kept the draft, so the next Continue sent the old draft against the newer validator and could overwrite another admin's save. If that reload was still pending or failed, Continue skipped the row and finished the step with the edit unsaved. A failed save now keeps the draft on screen but locks the row, says the save wasn't confirmed, and offers "Reload saved configuration (discard draft)", as the admin Providers page does. Continue stays disabled until the row is reloaded; Skip still leaves without saving. Co-Authored-By: Claude Opus 5.5 --- .../setup-wizard/steps/SubtitlesStep.test.tsx | 83 +++++++++++++++---- .../setup-wizard/steps/SubtitlesStep.tsx | 80 ++++++++++++------ 2 files changed, 120 insertions(+), 43 deletions(-) diff --git a/web/src/pages/setup-wizard/steps/SubtitlesStep.test.tsx b/web/src/pages/setup-wizard/steps/SubtitlesStep.test.tsx index 81e2323e56..dc2a858d5a 100644 --- a/web/src/pages/setup-wizard/steps/SubtitlesStep.test.tsx +++ b/web/src/pages/setup-wizard/steps/SubtitlesStep.test.tsx @@ -4,13 +4,14 @@ import { beforeEach, describe, expect, it, vi } from "vitest"; import { SubtitlesStep } from "./SubtitlesStep"; -const wizardMock = vi.fn(); -vi.mock("../WizardContext", () => ({ useWizardContext: () => wizardMock() })); +const markDone = vi.fn(); +vi.mock("../WizardContext", () => ({ + useWizardContext: () => ({ markDone, setSummary: vi.fn() }), +})); const updateMock = vi.fn(); -// Keep `data` the same object across renders, as React Query does. A new one -// re-runs the step's load effect, whose cleanup cancels an editor read still -// in flight and leaves the row loading. +// One object for every render, as React Query returns stable data; a new one +// each time would restart the step's editor load on every re-render. const providersQuery = { data: { providers: [ @@ -28,22 +29,26 @@ vi.mock("@/hooks/queries/admin/subtitles", () => ({ useTestSubtitleProvider: () => ({ mutate: vi.fn(), isPending: false }), })); +const editorMock = vi.fn(); vi.mock("@/api/v2/adminSubtitleProviderConfiguration", () => ({ captureProviderEditIntent: (provider: string) => ({ provider }), providerIntentActive: () => true, - getProviderEditor: (intent: { provider: string }) => - Promise.resolve({ - intent, - etag: '"1"', - body: { - provider_name: intent.provider, - enabled: false, - has_api_key: false, - has_credentials: false, - }, - }), + getProviderEditor: (intent: { provider: string }) => editorMock(intent), })); +function editor(intent: { provider: string }, etag: string, enabled: boolean, hasKey: boolean) { + return { + intent, + etag, + body: { + provider_name: intent.provider, + enabled, + has_api_key: hasKey, + has_credentials: false, + }, + }; +} + class ResizeObserverStub { observe() {} unobserve() {} @@ -54,7 +59,7 @@ globalThis.ResizeObserver ??= ResizeObserverStub as unknown as typeof ResizeObse describe("SubtitlesStep", () => { beforeEach(() => { vi.clearAllMocks(); - wizardMock.mockReturnValue({ markDone: vi.fn(), setSummary: vi.fn() }); + editorMock.mockImplementation((intent) => Promise.resolve(editor(intent, '"1"', false, false))); updateMock.mockResolvedValue({ saved_revision: "2", local_apply: "not_configured" }); }); @@ -74,4 +79,48 @@ describe("SubtitlesStep", () => { await waitFor(() => expect(updateMock).toHaveBeenCalledTimes(1)); expect(updateMock.mock.calls[0]![0].config).toStrictEqual({ enabled: false }); }); + + it("keeps a failed save from being sent again until the admin reloads it", async () => { + const user = userEvent.setup(); + render(); + + const toggle = screen.getByRole("switch", { name: "Enable SubDL" }); + await waitFor(() => expect(toggle).toBeEnabled()); + await user.click(toggle); + await user.type(screen.getByLabelText("API key"), "typed-key"); + + // Another admin saves SubDL first, so this save is refused and every + // later read returns their configuration. + updateMock.mockRejectedValueOnce(new Error("precondition failed")); + editorMock.mockImplementation((intent) => Promise.resolve(editor(intent, '"2"', true, true))); + await user.click(screen.getByRole("button", { name: "Continue" })); + await waitFor(() => expect(updateMock).toHaveBeenCalledTimes(1)); + const continueButton = await screen.findByRole("button", { name: "Continue" }); + + // Continuing again must neither re-send the old draft nor finish the step. + await user.click(continueButton); + expect(updateMock).toHaveBeenCalledTimes(1); + expect(markDone).not.toHaveBeenCalled(); + expect(screen.getByLabelText("API key")).toHaveValue("typed-key"); + + // A reload that fails keeps the row locked and leaves the way to try again. + const reload = screen.getByRole("button", { + name: "Reload saved configuration (discard draft)", + }); + editorMock.mockRejectedValueOnce(new Error("load failed")); + await user.click(reload); + await screen.findByText("Unable to load saved configuration. Reload before editing."); + expect(reload).toBeEnabled(); + expect(continueButton).toBeDisabled(); + expect(screen.getByLabelText("API key")).toHaveValue("typed-key"); + + // Reloading discards the draft and shows the other admin's saved state. + await user.click(reload); + await waitFor(() => expect(screen.getByLabelText("API key")).toHaveValue("")); + expect(toggle).toBeChecked(); + + await user.click(screen.getByRole("button", { name: "Continue" })); + expect(markDone).toHaveBeenCalledWith("subtitles"); + expect(updateMock).toHaveBeenCalledTimes(1); + }); }); diff --git a/web/src/pages/setup-wizard/steps/SubtitlesStep.tsx b/web/src/pages/setup-wizard/steps/SubtitlesStep.tsx index 6cdcb75a6f..dc5eaf156a 100644 --- a/web/src/pages/setup-wizard/steps/SubtitlesStep.tsx +++ b/web/src/pages/setup-wizard/steps/SubtitlesStep.tsx @@ -52,6 +52,8 @@ interface ProviderDraft { username: string; password: string; dirty: boolean; + /** The last save failed: the draft stays on screen, locked, until a reload. */ + saveFailed: boolean; } function draftFor(config: SubtitleProviderConfig): ProviderDraft { @@ -65,6 +67,7 @@ function draftFor(config: SubtitleProviderConfig): ProviderDraft { username: "", password: "", dirty: false, + saveFailed: false, }; } @@ -85,11 +88,13 @@ function ProviderRow({ config, draft, onChange, + onReload, disabled, }: { config: SubtitleProviderConfig; draft: ProviderDraft; onChange: (next: ProviderDraft) => void; + onReload: () => void; disabled: boolean; }) { const t = useT(); @@ -133,15 +138,22 @@ function ProviderRow({ ); } - const rowDisabled = disabled || draft.loading || draft.loadFailed; + const rowDisabled = disabled || draft.loading || draft.loadFailed || draft.saveFailed; + + let description = meta ? t(meta.description) : ""; + if (draft.saveFailed) { + description = draft.loadFailed + ? t("web.admin.settings.providers.subtitles.loadFailed") + : t("web.admin.settings.providers.subtitles.saveNotConfirmed"); + } else if (draft.loadFailed) { + description = t("web.setup.subtitles.loadFailed"); + } return ( <> @@ -157,7 +169,7 @@ function ProviderRow({ onCheckedChange={(v) => onChange({ ...draft, enabled: v, dirty: true })} /> - {draft.enabled && !draft.loadFailed ? ( + {draft.enabled && (draft.saveFailed || !draft.loadFailed) ? (
{isOpenSubtitles ? ( <> @@ -212,6 +224,19 @@ function ProviderRow({
) : null} + {draft.saveFailed ? ( +
+ +
+ ) : null} ); } @@ -232,9 +257,9 @@ export function SubtitlesStep() { // Editing a provider needs its strong validator, which only the per-provider // read returns. Each one is loaded once when the list arrives so the switch - // can be flipped straight away, and reloaded after a failed save so a retry - // never carries a stale validator. A row whose editor fails to load stays - // read-only. + // can be flipped straight away, and again after a save or when the admin + // reloads a failed one. A load always shows the saved state and drops any + // draft. A row whose editor fails to load stays read-only. const loadEditor = useCallback( (config: SubtitleProviderConfig, isCancelled: () => boolean) => { const name = config.provider_name; @@ -256,18 +281,10 @@ export function SubtitlesStep() { loaded.current.delete(name); return; } - setDrafts((prev) => { - const current = prev[name] ?? draftFor(config); - return { - ...prev, - [name]: { - ...current, - editor, - loading: false, - enabled: current.dirty ? current.enabled : editor.body.enabled, - }, - }; - }); + setDrafts((prev) => ({ + ...prev, + [name]: { ...draftFor(editor.body), editor, loading: false }, + })); }) .catch(() => { if (isCancelled()) { @@ -322,8 +339,9 @@ export function SubtitlesStep() { } setSubmitting(true); // Each provider is its own resource with its own validator, so the saves - // are independent and run together. A failed one keeps its draft but - // reloads its validator, so the retry cannot send a stale If-Match. + // are independent and run together. A failed one may still have been + // written, or lost to another admin's save, so its draft is never sent + // again: the row locks until the admin reloads it and sees what is saved. const results = await Promise.allSettled( changed.map(async (config) => { const name = config.provider_name; @@ -362,17 +380,23 @@ export function SubtitlesStep() { ...prev, [failure.config.provider_name]: { ...prev[failure.config.provider_name]!, - editor: null, - loading: true, - loadFailed: false, + saveFailed: true, }, })); - loadEditor(failure.config, () => false); } const reason = failures[0]!.reason; toast.error(reason instanceof Error ? reason.message : t("web.setup.subtitles.saveFailed")); } + function reloadEditor(config: SubtitleProviderConfig) { + const name = config.provider_name; + setDrafts((prev) => ({ + ...prev, + [name]: { ...prev[name]!, loading: true, loadFailed: false }, + })); + loadEditor(config, () => false); + } + if (providers.isLoading) return ; return ( @@ -381,6 +405,9 @@ export function SubtitlesStep() { lede={t("web.setup.subtitles.lede")} onSubmit={handleSubmit} busy={submitting} + // A failed save must be reloaded first, so the step never finishes with + // that change unsaved. Skip still leaves without saving. + disabled={providerList.some((p) => drafts[p.provider_name]?.saveFailed)} onSkip={() => markDone("subtitles")} footnote={t("web.setup.subtitles.footnote")} > @@ -412,6 +439,7 @@ export function SubtitlesStep() { config={config} draft={drafts[config.provider_name] ?? draftFor(config)} onChange={(next) => setDrafts((prev) => ({ ...prev, [config.provider_name]: next }))} + onReload={() => reloadEditor(config)} disabled={submitting} /> )) From 7d31f4726a12064aeccc81d455ecf1f4e073ede6 Mon Sep 17 00:00:00 2001 From: Quick104 <31828688+Quick104@users.noreply.github.com> Date: Fri, 20 Nov 2026 20:11:54 -0500 Subject: [PATCH 2/7] fix(web): put the wizard's reload action where Test was and flag the locked row From the visual review of the locked state: Reload replaces the disabled Test connection button in the same style, the reason shows as a warning status under the provider's own description, the failed save's toast closes on Reload, and the Reload label and warning wrap at phone width in longer languages. Co-Authored-By: Claude Opus 5.5 --- .../setup-wizard/steps/SubtitlesStep.tsx | 132 +++++++++++------- 1 file changed, 78 insertions(+), 54 deletions(-) diff --git a/web/src/pages/setup-wizard/steps/SubtitlesStep.tsx b/web/src/pages/setup-wizard/steps/SubtitlesStep.tsx index dc5eaf156a..0a8cd70bde 100644 --- a/web/src/pages/setup-wizard/steps/SubtitlesStep.tsx +++ b/web/src/pages/setup-wizard/steps/SubtitlesStep.tsx @@ -20,7 +20,11 @@ import { } from "@/hooks/queries/admin/subtitles"; import { useT, type MessageKey } from "@/i18n"; import { sortSubtitleProviders } from "@/lib/subtitleProviders"; -import { SettingField, SettingFieldRow } from "@/pages/admin-settings/SettingField"; +import { + SettingField, + SettingFieldRow, + SettingFieldStatus, +} from "@/pages/admin-settings/SettingField"; import { StepFrame, StepSection, StepSkeleton } from "../StepFrame"; import { useStepSummary } from "../useStep"; @@ -141,27 +145,46 @@ function ProviderRow({ const rowDisabled = disabled || draft.loading || draft.loadFailed || draft.saveFailed; let description = meta ? t(meta.description) : ""; + if (draft.loadFailed && !draft.saveFailed) description = t("web.setup.subtitles.loadFailed"); + + let status = null; if (draft.saveFailed) { - description = draft.loadFailed - ? t("web.admin.settings.providers.subtitles.loadFailed") - : t("web.admin.settings.providers.subtitles.saveNotConfirmed"); - } else if (draft.loadFailed) { - description = t("web.setup.subtitles.loadFailed"); + // A locked row says why it is locked, and Continue waits on it. + status = ( + + + {draft.loadFailed + ? t("web.admin.settings.providers.subtitles.loadFailed") + : t("web.admin.settings.providers.subtitles.saveNotConfirmed")} + + + ); + } else if (hasCredentials && !draft.dirty) { + status = ( + + {t("web.setup.subtitles.credentialsSaved")} + + ); } + const reloadButton = draft.saveFailed ? ( + + ) : null; + return ( <> - - {t("web.setup.subtitles.credentialsSaved")} - - ) : undefined - } - > + )}
- - {testResult !== null ? ( - - {testResult.success - ? t("web.setup.wizard.connected") - : (testResult.error ?? t("web.setup.subtitles.failed"))} - - ) : null} + {/* A locked row can only be reloaded, so Reload takes Test's place. */} + {reloadButton ?? ( + <> + + {testResult !== null ? ( + + {testResult.success + ? t("web.setup.wizard.connected") + : (testResult.error ?? t("web.setup.subtitles.failed"))} + + ) : null} + + )}
- ) : null} - {draft.saveFailed ? ( -
- -
+ ) : reloadButton ? ( + // A provider switched off has no fields, so Reload gets its own row. +
{reloadButton}
) : null} ); @@ -249,6 +267,8 @@ export function SubtitlesStep() { const [submitting, setSubmitting] = useState(false); const [drafts, setDrafts] = useState>({}); const loaded = useRef(new Set()); + // The failed save's toast says to fetch again and retry; a reload does that. + const saveErrorToast = useRef(undefined); const providerList = useMemo( () => sortSubtitleProviders(providers.data?.providers ?? []), @@ -385,11 +405,15 @@ export function SubtitlesStep() { })); } const reason = failures[0]!.reason; - toast.error(reason instanceof Error ? reason.message : t("web.setup.subtitles.saveFailed")); + saveErrorToast.current = toast.error( + reason instanceof Error ? reason.message : t("web.setup.subtitles.saveFailed"), + ); } function reloadEditor(config: SubtitleProviderConfig) { const name = config.provider_name; + // Without an id, dismiss would clear every toast on screen. + if (saveErrorToast.current !== undefined) toast.dismiss(saveErrorToast.current); setDrafts((prev) => ({ ...prev, [name]: { ...prev[name]!, loading: true, loadFailed: false }, From 8ef910260024f3ca0db6d9d1ee3631ee9d14eb8a Mon Sep 17 00:00:00 2001 From: Quick104 <31828688+Quick104@users.noreply.github.com> Date: Fri, 20 Nov 2026 20:22:54 -0500 Subject: [PATCH 3/7] fix(web): keep focus on the wizard's provider row after a reload Reload disappears once the saved configuration is back, so focus moves to the provider's switch instead of falling back to the page. Co-Authored-By: Claude Opus 5.5 --- .../setup-wizard/steps/SubtitlesStep.test.tsx | 1 + .../pages/setup-wizard/steps/SubtitlesStep.tsx | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/web/src/pages/setup-wizard/steps/SubtitlesStep.test.tsx b/web/src/pages/setup-wizard/steps/SubtitlesStep.test.tsx index dc2a858d5a..4798071bdf 100644 --- a/web/src/pages/setup-wizard/steps/SubtitlesStep.test.tsx +++ b/web/src/pages/setup-wizard/steps/SubtitlesStep.test.tsx @@ -118,6 +118,7 @@ describe("SubtitlesStep", () => { await user.click(reload); await waitFor(() => expect(screen.getByLabelText("API key")).toHaveValue("")); expect(toggle).toBeChecked(); + expect(toggle).toHaveFocus(); await user.click(screen.getByRole("button", { name: "Continue" })); expect(markDone).toHaveBeenCalledWith("subtitles"); diff --git a/web/src/pages/setup-wizard/steps/SubtitlesStep.tsx b/web/src/pages/setup-wizard/steps/SubtitlesStep.tsx index 0a8cd70bde..438dd2e2c7 100644 --- a/web/src/pages/setup-wizard/steps/SubtitlesStep.tsx +++ b/web/src/pages/setup-wizard/steps/SubtitlesStep.tsx @@ -144,6 +144,16 @@ function ProviderRow({ const rowDisabled = disabled || draft.loading || draft.loadFailed || draft.saveFailed; + // Reload disappears once the saved state is back, so focus moves to the + // provider's switch instead of dropping to the page. + const switchRef = useRef(null); + const refocusAfterReload = useRef(false); + useEffect(() => { + if (!refocusAfterReload.current || draft.saveFailed) return; + refocusAfterReload.current = false; + switchRef.current?.focus(); + }, [draft.saveFailed]); + let description = meta ? t(meta.description) : ""; if (draft.loadFailed && !draft.saveFailed) description = t("web.setup.subtitles.loadFailed"); @@ -172,7 +182,10 @@ function ProviderRow({ type="button" variant="secondary" size="sm" - onClick={onReload} + onClick={() => { + refocusAfterReload.current = true; + onReload(); + }} disabled={disabled || draft.loading} // The label is long and longer still in most languages, so it wraps // rather than widening the card on a phone. @@ -186,6 +199,7 @@ function ProviderRow({ <> Date: Fri, 20 Nov 2026 20:32:37 -0500 Subject: [PATCH 4/7] fix(web): drop the wizard's Test result when a provider row is reloaded Reload resets the draft to the saved configuration, which can be another admin's, so a Test result from before no longer applies to it. Co-Authored-By: Claude Opus 5.5 --- web/src/pages/setup-wizard/steps/SubtitlesStep.tsx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/web/src/pages/setup-wizard/steps/SubtitlesStep.tsx b/web/src/pages/setup-wizard/steps/SubtitlesStep.tsx index 438dd2e2c7..d14a7c732f 100644 --- a/web/src/pages/setup-wizard/steps/SubtitlesStep.tsx +++ b/web/src/pages/setup-wizard/steps/SubtitlesStep.tsx @@ -183,6 +183,9 @@ function ProviderRow({ variant="secondary" size="sm" onClick={() => { + // The reloaded credentials may be another admin's, so an earlier + // Test result says nothing about them. + setTested(null); refocusAfterReload.current = true; onReload(); }} From 149e948a017849bd4ccd77ca6671314563725199 Mon Sep 17 00:00:00 2001 From: Quick104 <31828688+Quick104@users.noreply.github.com> Date: Fri, 20 Nov 2026 20:37:04 -0500 Subject: [PATCH 5/7] fix(web): tie the wizard's Test result to the saved revision and keep Reload focusable From the adversarial review of the failed-save lock: - A Test result is shown only while the editor revision it was taken against is still loaded, so a reload of another admin's save (or a test still running when the save failed) can't bring back an old result. - Reload stays focusable while it runs, so a keyboard user keeps their place if it fails, and the switch takes focus after a successful reload only when focus hasn't moved elsewhere. - The failed save's toast uses a fixed id, which Reload dismisses. Co-Authored-By: Claude Opus 5.5 --- .../setup-wizard/steps/SubtitlesStep.tsx | 44 +++++++++++-------- 1 file changed, 26 insertions(+), 18 deletions(-) diff --git a/web/src/pages/setup-wizard/steps/SubtitlesStep.tsx b/web/src/pages/setup-wizard/steps/SubtitlesStep.tsx index d14a7c732f..be9bee44f7 100644 --- a/web/src/pages/setup-wizard/steps/SubtitlesStep.tsx +++ b/web/src/pages/setup-wizard/steps/SubtitlesStep.tsx @@ -109,19 +109,20 @@ function ProviderRow({ const canonical = draft.editor?.body ?? config; const hasCredentials = isOpenSubtitles ? canonical.has_credentials : canonical.has_api_key; const test = useTestSubtitleProvider(); - // The result is kept with the exact credentials it tested and shown only - // while the draft still matches them, so editing a field clears it and a - // late response for an older draft is never shown against the new one. + // The result is kept with the exact credentials it tested, and the saved + // revision behind them, and shown only while both still match. Editing a + // field or reloading another admin's save clears it, and a late response + // for an older draft is never shown against the new one. const [tested, setTested] = useState<{ signature: string; result: { success: boolean; error?: string }; } | null>(null); - const signature = JSON.stringify(providerBody(name, draft)); + const signature = JSON.stringify([draft.editor?.etag ?? null, providerBody(name, draft)]); const testResult = tested?.signature === signature ? tested.result : null; function runTest() { const body = providerBody(name, draft); - const testedSignature = JSON.stringify(body); + const testedSignature = signature; test.mutate( { provider: name, config: body }, { @@ -145,12 +146,15 @@ function ProviderRow({ const rowDisabled = disabled || draft.loading || draft.loadFailed || draft.saveFailed; // Reload disappears once the saved state is back, so focus moves to the - // provider's switch instead of dropping to the page. + // provider's switch instead of dropping to the page. Focus the admin moved + // elsewhere meanwhile stays where it is. const switchRef = useRef(null); const refocusAfterReload = useRef(false); useEffect(() => { if (!refocusAfterReload.current || draft.saveFailed) return; refocusAfterReload.current = false; + const active = document.activeElement; + if (active && active !== document.body && active.isConnected) return; switchRef.current?.focus(); }, [draft.saveFailed]); @@ -178,21 +182,25 @@ function ProviderRow({ } const reloadButton = draft.saveFailed ? ( + // Its own key, so React doesn't turn this node into Test connection (and + // carry focus over) when the row unlocks. @@ -276,6 +284,8 @@ function ProviderRow({ ); } +const SAVE_ERROR_TOAST = "setup-subtitles-save-failed"; + export function SubtitlesStep() { const { markDone } = useWizardContext(); const t = useT(); @@ -284,8 +294,6 @@ export function SubtitlesStep() { const [submitting, setSubmitting] = useState(false); const [drafts, setDrafts] = useState>({}); const loaded = useRef(new Set()); - // The failed save's toast says to fetch again and retry; a reload does that. - const saveErrorToast = useRef(undefined); const providerList = useMemo( () => sortSubtitleProviders(providers.data?.providers ?? []), @@ -422,15 +430,15 @@ export function SubtitlesStep() { })); } const reason = failures[0]!.reason; - saveErrorToast.current = toast.error( - reason instanceof Error ? reason.message : t("web.setup.subtitles.saveFailed"), - ); + toast.error(reason instanceof Error ? reason.message : t("web.setup.subtitles.saveFailed"), { + id: SAVE_ERROR_TOAST, + }); } function reloadEditor(config: SubtitleProviderConfig) { const name = config.provider_name; - // Without an id, dismiss would clear every toast on screen. - if (saveErrorToast.current !== undefined) toast.dismiss(saveErrorToast.current); + // The failed save's toast says to fetch again and retry; a reload does that. + toast.dismiss(SAVE_ERROR_TOAST); setDrafts((prev) => ({ ...prev, [name]: { ...prev[name]!, loading: true, loadFailed: false }, From 237bc2888e838eddbf464084ce46d1001816b0f6 Mon Sep 17 00:00:00 2001 From: Quick104 <31828688+Quick104@users.noreply.github.com> Date: Fri, 20 Nov 2026 20:46:03 -0500 Subject: [PATCH 6/7] fix(web): keep a locked wizard row reachable when the provider list fails to refresh A save that succeeds refreshes the provider list. If that refresh fails, the step now keeps showing the rows it already has, so a row locked by another provider's failed save keeps its Reload button; the list error view is only for a first load that failed. The locked row's warning is a live region, so a failed reload's message is announced. Co-Authored-By: Claude Opus 5.5 --- web/src/pages/setup-wizard/steps/SubtitlesStep.tsx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/web/src/pages/setup-wizard/steps/SubtitlesStep.tsx b/web/src/pages/setup-wizard/steps/SubtitlesStep.tsx index be9bee44f7..1a8f0c2140 100644 --- a/web/src/pages/setup-wizard/steps/SubtitlesStep.tsx +++ b/web/src/pages/setup-wizard/steps/SubtitlesStep.tsx @@ -153,8 +153,7 @@ function ProviderRow({ useEffect(() => { if (!refocusAfterReload.current || draft.saveFailed) return; refocusAfterReload.current = false; - const active = document.activeElement; - if (active && active !== document.body && active.isConnected) return; + if (document.activeElement !== document.body) return; switchRef.current?.focus(); }, [draft.saveFailed]); @@ -166,7 +165,8 @@ function ProviderRow({ // A locked row says why it is locked, and Continue waits on it. status = ( - + {/* A live region, so a failed reload's new message is announced. */} + {draft.loadFailed ? t("web.admin.settings.providers.subtitles.loadFailed") : t("web.admin.settings.providers.subtitles.saveNotConfirmed")} @@ -461,7 +461,9 @@ export function SubtitlesStep() { footnote={t("web.setup.subtitles.footnote")} > - {providers.isError ? ( + {/* A failed refresh keeps the rows it already has, so a locked row's + Reload stays reachable; the error view is only for a first load. */} + {providers.isError && !providers.data ? (

{t("web.setup.subtitles.listLoadFailed")}

From 5070696ca455df815f57584a3f159b9d7d3ad16c Mon Sep 17 00:00:00 2001 From: Quick104 <31828688+Quick104@users.noreply.github.com> Date: Fri, 20 Nov 2026 20:52:00 -0500 Subject: [PATCH 7/7] fix(web): show the wizard's provider list error above the rows it keeps A failed refresh of the provider list now shows the existing error and its Try again button above the rows already loaded, rather than hiding the error. Co-Authored-By: Claude Opus 5.5 --- web/src/pages/setup-wizard/steps/SubtitlesStep.tsx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/web/src/pages/setup-wizard/steps/SubtitlesStep.tsx b/web/src/pages/setup-wizard/steps/SubtitlesStep.tsx index 1a8f0c2140..295d6db914 100644 --- a/web/src/pages/setup-wizard/steps/SubtitlesStep.tsx +++ b/web/src/pages/setup-wizard/steps/SubtitlesStep.tsx @@ -461,9 +461,9 @@ export function SubtitlesStep() { footnote={t("web.setup.subtitles.footnote")} > - {/* A failed refresh keeps the rows it already has, so a locked row's - Reload stays reachable; the error view is only for a first load. */} - {providers.isError && !providers.data ? ( + {/* A failed refresh shows its error above the rows it already has, + so a locked row's Reload stays reachable. */} + {providers.isError ? (

{t("web.setup.subtitles.listLoadFailed")}

@@ -481,7 +481,8 @@ export function SubtitlesStep() { {t("common.tryAgain")}

- ) : providerList.length === 0 ? ( + ) : null} + {!providers.data ? null : providerList.length === 0 ? (

{t("web.setup.subtitles.none")}

) : ( providerList.map((config) => (