mirror of
https://github.com/streamyfin/streamyfin.git
synced 2026-07-07 04:53:01 +01:00
The close-first + runAfterInteractions change (needed so the in-player audio switch's replacePlayer isn't swallowed by the modal route) also runs for every other tv-option-modal caller — detail-page audio, library filters, settings — whose onSelect only updates state. Deferring those until after dismissal re-renders the page after focus returns and yanks TV focus, leaving navigation stuck. Gate the deferral behind deferApplyUntilDismissed (set only by the in-player audio caller); everyone else applies before closing, as before.
28 lines
836 B
TypeScript
28 lines
836 B
TypeScript
import { atom } from "jotai";
|
|
|
|
export type TVOptionItem<T = any> = {
|
|
label: string;
|
|
sublabel?: string;
|
|
value: T;
|
|
selected: boolean;
|
|
};
|
|
|
|
export type TVOptionModalState = {
|
|
title: string;
|
|
options: TVOptionItem[];
|
|
onSelect: (value: any) => void;
|
|
cardWidth?: number;
|
|
cardHeight?: number;
|
|
/**
|
|
* Run onSelect AFTER the modal route is dismissed. Needed only when onSelect
|
|
* navigates (the in-player audio switch replacing the player while
|
|
* transcoding), which the still-active modal route would otherwise swallow.
|
|
* Default (false) runs onSelect before closing, so state-only callers (detail
|
|
* page, library filters, settings) don't re-render after focus returns and
|
|
* lose TV focus.
|
|
*/
|
|
deferApplyUntilDismissed?: boolean;
|
|
} | null;
|
|
|
|
export const tvOptionModalAtom = atom<TVOptionModalState>(null);
|