Replace useEffect with useLayoutEffect (#23)
This commit is contained in:
parent
6ab13a70d2
commit
13897e7217
@ -1,10 +1,10 @@
|
||||
import { BrowserRouter, Routes, Route, useLocation } from "react-router-dom";
|
||||
import { useLayoutEffect } from "react";
|
||||
import Editor from "./pages/Editor";
|
||||
import Survey from "./pages/Survey";
|
||||
import BugReport from "./pages/BugReport";
|
||||
import Shortcuts from "./pages/Shortcuts";
|
||||
import Templates from "./pages/Templates";
|
||||
import { useEffect, useLayoutEffect } from "react";
|
||||
import LandingPage from "./pages/LandingPage";
|
||||
import SettingsContextProvider from "./context/SettingsContext";
|
||||
import useSettings from "./hooks/useSettings";
|
||||
@ -82,7 +82,7 @@ function ThemedPage({ children }) {
|
||||
|
||||
function RestoreScroll() {
|
||||
const location = useLocation();
|
||||
useEffect(() => {
|
||||
useLayoutEffect(() => {
|
||||
window.scroll(0, 0);
|
||||
}, [location.pathname]);
|
||||
return null;
|
||||
|
Loading…
Reference in New Issue
Block a user