refactor: migrate to react-player v3, fixing multiple instance of video player being created

This commit is contained in:
Prayag Prajapati committed 2025-07-01 21:46:23 +05:30
1 parent c69a547379
commit c4073f1368
9 files changed
+1080 -2297

No files matched your search

+11 -15
View File
@@ -1,12 +1,9 @@
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import { RouterProvider, createRouter } from "@tanstack/react-router";
import React, { Suspense, useEffect } from "react";
import { createRouter, RouterProvider } from "@tanstack/react-router";
import React from "react";
import ReactDOM from "react-dom/client";
// Import the generated route tree
import { routeTree } from "./routeTree.gen";
import { ErrorBoundary } from "react-error-boundary";
import { ErrorNotice } from "./components/notices/errorNotice/errorNotice";
import { ApiProvider, useApiInContext } from "./utils/store/api";
import { CentralProvider, useCentralStore } from "./utils/store/central";
@@ -54,7 +51,6 @@ declare module "@tanstack/react-router" {
}
}
// biome-ignore lint/nursery/useComponentExportOnlyModules : This is a valid use case for a component export
function ProviderWrapper() {
const [api, createApi, jellyfinSDK] = useApiInContext((s) => [
s.api,
@@ -68,15 +64,15 @@ function ProviderWrapper() {
if (api?.accessToken && !user?.Id) {
fetchCurrentUser(api);
}
useEffect(() => {
if (api) {
console.log(`API is set - Route ${window.location.pathname}`);
console.log(api);
} else {
console.log(`API is not set - Route ${window.location.pathname}`);
}
router.invalidate(); // This is a hack to force the router to re-evaluate the routes and re-run the beforeLoad functions
}, [api]);
// useEffect(() => {
// if (api) {
// console.log(`API is set - Route ${window.location.pathname}`);
// console.log(api);
// } else {
// console.log(`API is not set - Route ${window.location.pathname}`);
// }
// router.invalidate(); // This is a hack to force the router to re-evaluate the routes and re-run the beforeLoad functions
// }, [api]);
return (
<RouterProvider
router={router}