fix(errors,a11y): review round 1 — drop redundant onErrors, stabilize the live region
Review found my C-3.23 additions double-notified: the global error modal (api.ts req) already surfaces 400/409/422/500 with the backend's specific message, so a caller toast on those codes is a second, weaker surface. Only 403/404 are caller-handled and silent — and only a YouTube WRITE action has a meaningful 403 (missing scope). So the correct set is just the ChannelPage unsubscribe handler (a YouTube write, 403 → "connect", matching subscribe). Reverted the redundant onErrors on block (a local DB op, not YouTube), SettingsPanel Plex watch toggle/reimport, and the DownloadCenter job action — the global modal already speaks for them. Removed the three now-unused keys. Toaster: moved the polite live region onto the stable, always-mounted container (a polite region must pre-exist to announce later insertions); error/fatal toasts keep role="alert", which announces on insertion regardless.
This commit is contained in:
@@ -533,14 +533,15 @@ function PlexWatchSync() {
|
||||
}
|
||||
};
|
||||
|
||||
const onFail = () => notify({ level: "error", message: t("settings.plexSync.failed") });
|
||||
// No onError on these: they're Plex, not YouTube (notifyYouTubeActionError would wrongly say
|
||||
// "connect YouTube"), and their 409/500 are already surfaced by the global error modal — a caller
|
||||
// toast would double it. Actual import failures come back as 200 {error}, handled by announce.
|
||||
const toggle = useMutation({
|
||||
mutationFn: (next: boolean) => api.plexWatchSetLink(next),
|
||||
onSuccess: (res) => {
|
||||
qc.setQueryData(["plex-watch-link"], res);
|
||||
announce(res.import);
|
||||
},
|
||||
onError: onFail,
|
||||
});
|
||||
const reimport = useMutation({
|
||||
mutationFn: () => api.plexWatchImport(),
|
||||
@@ -548,7 +549,6 @@ function PlexWatchSync() {
|
||||
qc.setQueryData(["plex-watch-link"], res);
|
||||
announce(res.import);
|
||||
},
|
||||
onError: onFail,
|
||||
});
|
||||
|
||||
const busy = toggle.isPending || reimport.isPending;
|
||||
|
||||
Reference in New Issue
Block a user