mirror of
https://github.com/Stremio/stremio-web.git
synced 2026-05-10 23:50:42 +00:00
useFullscreen is now a thin useContext consumer of FullscreenProvider, so all callers share a single fullscreen state owned by the app root. Why this fixes the desync bug: stremio-router keeps multiple route layers mounted at once, and each top-level route (Board, Discover, Library, Calendar, Addons, Settings, Search) renders its own MainNavBars -> HorizontalNavBar -> useFullscreen. The previous hook held local useState plus its own listeners, so each route had an independent boolean. Entering fullscreen, then navigating to another tab, mounted a fresh hook initialized to false; the icon flipped back to "enter fullscreen" and clicking it re-requested fullscreen on top of the existing one, leaving the UI unresponsive until a route remount happened to coincide with reality. With one provider above the router, state outlives route remounts and listeners are attached exactly once. The hook's return tuple shape ([fullscreen, requestFullscreen, exitFullscreen, toggleFullscreen]) is preserved, so all three call sites (HorizontalNavBar, NavMenuContent, Player) keep working with no API change. Also removes the legacy src/common/useFullscreen.ts and routes its imports through stremio/common/Fullscreen (and the stremio/common barrel for App.js / Player). Note: MainNavBars is still rendered per-route. Lifting it to a single app-level layout above the router is a worthwhile follow-up (eliminates 6+ duplicate mounts) but carries non-trivial CSS / useRouteFocused / stacked-route risk and is out of scope for this PR; tracking separately. Made-with: Cursor |
||
|---|---|---|
| .. | ||
| FileDrop | ||
| Fullscreen | ||
| Platform | ||
| Shortcuts | ||
| Toast | ||
| Tooltips | ||
| animations.less | ||
| CONSTANTS.js | ||
| CoreSuspender.js | ||
| getVisibleChildrenRange.js | ||
| index.js | ||
| interfaceLanguages.json | ||
| languageNames.json | ||
| languages.ts | ||
| routesRegexp.js | ||
| screen-sizes.less | ||
| useAnimationFrame.js | ||
| useBinaryState.d.ts | ||
| useBinaryState.js | ||
| useInterval.ts | ||
| useLanguageSorting.ts | ||
| useLiveRef.js | ||
| useModelState.js | ||
| useNotifications.d.ts | ||
| useNotifications.js | ||
| useOnScrollToBottom.js | ||
| useOrientation.ts | ||
| useOutsideClick.ts | ||
| usePlayUrl.ts | ||
| useProfile.d.ts | ||
| useProfile.js | ||
| usePWA.js | ||
| useSettings.ts | ||
| useShell.ts | ||
| useStreamingServer.d.ts | ||
| useStreamingServer.js | ||
| useTimeout.ts | ||
| useTorrent.js | ||
| useTranslate.js | ||