fix(plex): give the library search its own ephemeral state

The Plex library search box wrote to the shared, persisted feed filter
(filters.q). That leaked a Plex query into the feed search box and, being
persisted, restored a stale query after a reload — which then collided
with a persisted collection filter to produce a confusing empty grid.
Plex now has its own search state: kept across page switches within a
session, but not persisted and not shared with the feed, so a reload
starts clean.
This commit is contained in:
npeter83 2026-07-08 23:19:36 +02:00
parent d84edebc09
commit a005a1bcbb
2 changed files with 28 additions and 8 deletions

View file

@ -260,6 +260,12 @@ export default function App() {
}
}, [plexFiltersRaw]);
const setPlexFilters = (f: PlexFilters) => setPlexFiltersRaw(JSON.stringify(f));
// The Plex library search term is its OWN ephemeral state — deliberately NOT the persisted feed
// `filters.q`. Sharing that box meant a Plex search leaked into the feed and, being persisted,
// greeted you with a stale query (colliding with a persisted collection filter → confusing
// "0 matches") after a reload. Kept in App so it survives page switches within a session, but
// resets on reload.
const [plexQ, setPlexQ] = useState("");
// Bumped to tell the channel manager to drop a stale column filter when we send the user
// there to see a specific set (the header's "without full history" link).
const [channelsFilterReset, setChannelsFilterReset] = useState(0);
@ -767,6 +773,8 @@ export default function App() {
me={meQuery.data!}
filters={filters}
setFilters={setFilters}
plexQ={plexQ}
setPlexQ={setPlexQ}
page={page}
onYtSearch={enterYtSearch}
/>
@ -819,8 +827,8 @@ export default function App() {
/>
) : page === "plex" && meQuery.data!.plex_enabled ? (
<PlexBrowse
q={filters.q}
onClearSearch={() => setFilters({ ...filters, q: "" })}
q={plexQ}
onClearSearch={() => setPlexQ("")}
library={plexLib}
show={plexShowFilter}
sort={plexSort}