fix(tv): only defer subtitle selection when it navigates

The close-first + runAfterInteractions pattern is needed only in the player,
where selecting a subtitle can navigate (replacePlayer for a burn-in switch
while transcoding). On the item detail page the selection just updates state, so
deferring it until after the modal is dismissed re-renders the page after focus
returns and yanks TV focus — leaving navigation stuck. Gate the deferral behind
deferApplyUntilDismissed (set by the in-player caller only); the detail page runs
the selection before closing, preserving focus.
This commit is contained in:
Gauvain
2026-07-07 00:33:09 +02:00
parent 461d055c7a
commit 5221ed1963
4 changed files with 28 additions and 8 deletions

View File

@@ -14,6 +14,7 @@ interface ShowSubtitleModalParams {
onServerSubtitleDownloaded?: () => void;
onLocalSubtitleDownloaded?: (path: string) => void;
refreshSubtitleTracks?: () => Promise<Track[]>;
deferApplyUntilDismissed?: boolean;
}
export const useTVSubtitleModal = () => {
@@ -30,6 +31,7 @@ export const useTVSubtitleModal = () => {
onServerSubtitleDownloaded: params.onServerSubtitleDownloaded,
onLocalSubtitleDownloaded: params.onLocalSubtitleDownloaded,
refreshSubtitleTracks: params.refreshSubtitleTracks,
deferApplyUntilDismissed: params.deferApplyUntilDismissed,
});
router.push("/(auth)/tv-subtitle-modal");
},