mirror of
https://github.com/stonith404/pingvin-share.git
synced 2025-01-15 01:14:27 -05:00
performance: remove initial props to opt in to static site generation
This commit is contained in:
parent
d906d56b9f
commit
7d8fc72394
1 changed files with 2 additions and 14 deletions
|
@ -9,8 +9,6 @@ import { useColorScheme } from "@mantine/hooks";
|
||||||
import { ModalsProvider } from "@mantine/modals";
|
import { ModalsProvider } from "@mantine/modals";
|
||||||
import { NotificationsProvider } from "@mantine/notifications";
|
import { NotificationsProvider } from "@mantine/notifications";
|
||||||
import { setCookies } from "cookies-next";
|
import { setCookies } from "cookies-next";
|
||||||
import { GetServerSidePropsContext } from "next";
|
|
||||||
import cookies from "next-cookies";
|
|
||||||
import type { AppProps } from "next/app";
|
import type { AppProps } from "next/app";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import Footer from "../components/Footer";
|
import Footer from "../components/Footer";
|
||||||
|
@ -23,14 +21,10 @@ import globalStyle from "../styles/mantine.style";
|
||||||
import { CurrentUser } from "../types/user.type";
|
import { CurrentUser } from "../types/user.type";
|
||||||
import { GlobalLoadingContext } from "../utils/loading.util";
|
import { GlobalLoadingContext } from "../utils/loading.util";
|
||||||
|
|
||||||
function App(props: AppProps & { colorScheme: ColorScheme }) {
|
function App({ Component, pageProps }: AppProps) {
|
||||||
const { Component, pageProps } = props;
|
|
||||||
|
|
||||||
const systemTheme = useColorScheme();
|
const systemTheme = useColorScheme();
|
||||||
|
|
||||||
const [colorScheme, setColorScheme] = useState<ColorScheme>(
|
const [colorScheme, setColorScheme] = useState<ColorScheme>();
|
||||||
props.colorScheme
|
|
||||||
);
|
|
||||||
const [isLoading, setIsLoading] = useState(true);
|
const [isLoading, setIsLoading] = useState(true);
|
||||||
const [user, setUser] = useState<CurrentUser | null>(null);
|
const [user, setUser] = useState<CurrentUser | null>(null);
|
||||||
|
|
||||||
|
@ -87,9 +81,3 @@ function App(props: AppProps & { colorScheme: ColorScheme }) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export default App;
|
export default App;
|
||||||
|
|
||||||
App.getInitialProps = ({ ctx }: { ctx: GetServerSidePropsContext }) => {
|
|
||||||
return {
|
|
||||||
colorScheme: cookies(ctx)["color-schema"] || "light",
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue