From 967ce013bfbbb73f83551f0cc16a2b7661bc5bc2 Mon Sep 17 00:00:00 2001 From: "Kalle (Sendou)" <38327916+Sendouc@users.noreply.github.com> Date: Fri, 8 Jan 2021 15:26:08 +0200 Subject: [PATCH] set search params without the whole layout reloading --- components/layout/index.tsx | 7 ++----- hooks/freeagents.ts | 6 ++---- lib/setSearchParams.ts | 18 ++++++++++++++++++ pages/_app.tsx | 8 +++++--- pages/freeagents.tsx | 2 -- 5 files changed, 27 insertions(+), 14 deletions(-) create mode 100644 lib/setSearchParams.ts diff --git a/components/layout/index.tsx b/components/layout/index.tsx index 72face22d..d26e1d117 100644 --- a/components/layout/index.tsx +++ b/components/layout/index.tsx @@ -1,7 +1,6 @@ import { Flex, useToast } from "@chakra-ui/react"; import { t } from "@lingui/macro"; import MyContainer from "components/common/MyContainer"; -import { AppProps } from "next/app"; import { useState } from "react"; import { SWRConfig } from "swr"; import Banner from "./Banner"; @@ -11,7 +10,7 @@ import TopNav from "./TopNav"; const DATE_KEYS = ["createdAt", "updatedAt"]; -const Layout = ({ Component, pageProps }: AppProps) => { +const Layout = ({ children }: { children: React.ReactNode }) => { const [errors, setErrors] = useState(new Set()); const toast = useToast(); @@ -47,9 +46,7 @@ const Layout = ({ Component, pageProps }: AppProps) => { - - - + {children}