From ea2e0a6b1c60591cc7d4ab4bb728dbc5262db736 Mon Sep 17 00:00:00 2001 From: Prayag Prajapati Date: Tue, 20 Feb 2024 11:53:45 +0530 Subject: [PATCH] fix(router): Remove ScrollRestoration and improve episodeSkeleton --- src/App.tsx | 6 ++---- src/components/nProgress/index.tsx | 1 + src/components/skeleton/seasonSelector.jsx | 5 +++++ src/main.tsx | 2 +- src/routes/series/index.jsx | 5 +++++ 5 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index 640c89e..416a5e8 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -5,10 +5,8 @@ import { AnimatePresence, motion } from "framer-motion"; import { SnackbarProvider } from "notistack"; import { Navigate, - Outlet, Route, Routes, - ScrollRestoration, useLocation, useNavigate, } from "react-router-dom"; @@ -224,7 +222,6 @@ function App() { return ; } - function AppReady() { const [audioPlayerVisible] = useAudioPlayback((state) => [state.display]); const { enqueueSnackbar } = useSnackbar(); @@ -251,6 +248,8 @@ function AppReady() { const isQueryFetching = useIsFetching(); const isMutating = useIsMutating(); + useEffect(() => window.scrollTo(0, 0), [location.key]); + useLayoutEffect(() => { async function checkForUpdates() { try { @@ -288,7 +287,6 @@ function AppReady() { - = ({ > { animationDelay: `${index * 0.2}s`, animationDuration: "1.4s", animationName: "pulse", + opacity: 0.1, }} /> @@ -80,6 +81,7 @@ export const SeasonSelectorSkeleton = () => { animationDelay: `${index * 0.2}s`, animationDuration: "1.4s", animationName: "pulse", + opacity: 0.1, }} /> @@ -91,6 +93,7 @@ export const SeasonSelectorSkeleton = () => { animationDelay: `${index * 0.2}s`, animationDuration: "1.4s", animationName: "pulse", + opacity: 0.1, }} /> { animationDelay: `${index * 0.2}s`, animationDuration: "1.4s", animationName: "pulse", + opacity: 0.1, }} /> @@ -108,6 +112,7 @@ export const SeasonSelectorSkeleton = () => { animationDelay: `${index * 0.2}s`, animationDuration: "1.4s", animationName: "pulse", + opacity: 0.1, }} /> diff --git a/src/main.tsx b/src/main.tsx index 86124b1..c2ecd7f 100644 --- a/src/main.tsx +++ b/src/main.tsx @@ -1,6 +1,6 @@ import React from "react"; import ReactDOM from "react-dom/client"; -import { BrowserRouter as Router } from "react-router-dom"; +import { MemoryRouter as Router } from "react-router-dom"; import { QueryClient, QueryClientProvider } from "@tanstack/react-query"; diff --git a/src/routes/series/index.jsx b/src/routes/series/index.jsx index f3b9762..63cb5a3 100644 --- a/src/routes/series/index.jsx +++ b/src/routes/series/index.jsx @@ -934,6 +934,7 @@ const SeriesTitlePage = () => { animationDelay: `${index * 0.2}s`, animationDuration: "1.4s", animationName: "pulse", + opacity: 0.1, }} /> @@ -951,6 +952,7 @@ const SeriesTitlePage = () => { animationDelay: `${index * 0.2}s`, animationDuration: "1.4s", animationName: "pulse", + opacity: 0.1, }} /> @@ -962,6 +964,7 @@ const SeriesTitlePage = () => { animationDelay: `${index * 0.2}s`, animationDuration: "1.4s", animationName: "pulse", + opacity: 0.1, }} /> { animationDelay: `${index * 0.2}s`, animationDuration: "1.4s", animationName: "pulse", + opacity: 0.1, }} /> @@ -979,6 +983,7 @@ const SeriesTitlePage = () => { animationDelay: `${index * 0.2}s`, animationDuration: "1.4s", animationName: "pulse", + opacity: 0.1, }} />