Skip to content

Commit

Permalink
feat: add speed insights
Browse files Browse the repository at this point in the history
  • Loading branch information
nezutero committed Dec 7, 2023
1 parent 56ecb8b commit e0398fb
Showing 1 changed file with 22 additions and 20 deletions.
42 changes: 22 additions & 20 deletions pages/_app.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,33 @@ import Fonts from "../components/fonts";
import { AnimatePresence } from "framer-motion";
import Chakra from "../components/chakra";
import { Analytics } from "@vercel/analytics/react";
import { SpeedInsights } from "@vercel/speed-insights/next"

if (typeof window !== "undefined") {
window.history.scrollRestoration = "manual";
window.history.scrollRestoration = "manual";
}

function Website({ Component, pageProps, router }) {
return (
<Chakra cookies={pageProps.cookies}>
<Fonts />
<Layout router={router}>
<AnimatePresence
exitBeforeEnter
initial={true}
onExitComplete={() => {
if (typeof window !== "undefined") {
window.scrollTo({ top: 0 });
}
}}
>
<Component {...pageProps} key={router.route} />
</AnimatePresence>
</Layout>
<Analytics />
</Chakra>
);
return (
<Chakra cookies={pageProps.cookies}>
<Fonts />
<Layout router={router}>
<AnimatePresence
exitBeforeEnter
initial={true}
onExitComplete={() => {
if (typeof window !== "undefined") {
window.scrollTo({ top: 0 });
}
}}
>
<Component {...pageProps} key={router.route} />
</AnimatePresence>
</Layout>
<Analytics />
<SpeedInsights />
</Chakra>
);
}

export default Website;

0 comments on commit e0398fb

Please sign in to comment.