feat(plex): every card rail in the reader's language; an episode in a poster rail stands as its show (E30 S1b)
The grid served Hungarian titles, but every other card surface (Discover rails, the show page's episodes, search, collections, the person page, playlists, Home's resume rail, hero and comfort shelf) served English. The card serializers now take a required keyword-only lang (a forgotten call site fails instead of going English), and each of those reads takes ?lang=hu, with the language in its query key. A Hungarian search finds an episode by its Hungarian title too. An episode on a poster rail showed its 16:9 still cropped into a poster, titled only with the episode name; it now shows the show's poster and name, with S·E · title under it (option A). Plex's generic season names (Season 1, Specials) are rebuilt from the number in the reader's language; a season with a name of its own keeps it. Home's comfort-shelf move wrote its optimistic order to the key without the language, which nothing read any more; it writes the query's own key.
This commit is contained in:
@@ -3,6 +3,7 @@ import { useTranslation } from "react-i18next";
|
||||
import { useQuery, useQueryClient } from "@tanstack/react-query";
|
||||
import { Play, Shuffle, Pencil, Trash2, Plus, X, Lock, Check, Search } from "lucide-react";
|
||||
import { qk } from "../lib/queryKeys";
|
||||
import { plexLang } from "../i18n";
|
||||
import { api, isIntrinsicReadOnly, type PlexCard, type PlexCollectionDetail } from "../lib/api";
|
||||
import { formatRuntime } from "../lib/format";
|
||||
import { notifyActionError } from "../lib/actionErrors";
|
||||
@@ -83,10 +84,11 @@ export default function PlexCollectionView({
|
||||
// ONE key for the read and every write into it: when the sort joined the key, the watched toggle's
|
||||
// optimistic write kept the old spelling and landed on an entry nothing reads (setQueryData matches
|
||||
// exactly), so the click did nothing visible until a reload.
|
||||
const detailKey = qk.plexCollections("detail", collectionId, sortPref.key, sortPref.dir);
|
||||
const lang = plexLang();
|
||||
const detailKey = qk.plexCollections("detail", collectionId, sortPref.key, sortPref.dir, lang);
|
||||
const q = useQuery({
|
||||
queryKey: detailKey,
|
||||
queryFn: () => api.plexCollection(collectionId, sortPref),
|
||||
queryFn: () => api.plexCollection(collectionId, sortPref, lang),
|
||||
// A re-sort keeps the current page on screen while the new order loads. Without it every sort
|
||||
// change was a key with no data yet, and the whole page — the Sort control and its open panel
|
||||
// with it — was swapped for a spinner, so key and direction could not be set in one visit. Only
|
||||
@@ -134,8 +136,8 @@ export default function PlexCollectionView({
|
||||
items.map(async (c) => {
|
||||
if (c.type !== "show") return [c.id];
|
||||
const detail = await qc.fetchQuery({
|
||||
queryKey: qk.plexShow(c.id),
|
||||
queryFn: () => api.plexShow(c.id),
|
||||
queryKey: qk.plexShow(c.id, lang),
|
||||
queryFn: () => api.plexShow(c.id, lang),
|
||||
});
|
||||
return showEpisodeKeys(detail);
|
||||
}),
|
||||
|
||||
Reference in New Issue
Block a user