From 0cf8316065a22e1a992342d336d4c8d41861649c Mon Sep 17 00:00:00 2001 From: Jib Date: Tue, 27 Feb 2024 12:29:53 -0500 Subject: [PATCH] Wrap cope points in suspense boundaries (#28) --- .../frontend/app/login/page.tsx | 31 ++++++++++--------- .../frontend/app/page.tsx | 27 +++++++++------- .../frontend/app/reset-password/page.tsx | 20 +++++++----- 3 files changed, 44 insertions(+), 34 deletions(-) diff --git a/{{cookiecutter.project_slug}}/frontend/app/login/page.tsx b/{{cookiecutter.project_slug}}/frontend/app/login/page.tsx index 1947242..63bcfc6 100644 --- a/{{cookiecutter.project_slug}}/frontend/app/login/page.tsx +++ b/{{cookiecutter.project_slug}}/frontend/app/login/page.tsx @@ -1,11 +1,11 @@ -"use client"; - -import { useAppDispatch, useAppSelector } from "../lib/hooks"; -import { login, loggedIn } from "../lib/slices/authSlice"; -import { useRouter, useSearchParams } from "next/navigation"; -import { tokenIsTOTP, tokenParser } from "../lib/utilities"; -import { Switch } from "@headlessui/react"; -import { useEffect, useState } from "react"; +"use client" + +import { useAppDispatch, useAppSelector } from "../lib/hooks" +import { login, loggedIn } from "../lib/slices/authSlice" +import { useRouter, useSearchParams } from "next/navigation" +import { tokenIsTOTP, tokenParser } from "../lib/utilities" +import { Switch } from "@headlessui/react" +import { Suspense, useEffect, useState } from "react" import { FieldErrors, FieldValues, @@ -101,12 +101,11 @@ function LoginMessage(oauth: boolean) { ); } -export default function Page() { - const [oauth, setOauth] = useState(false); - const dispatch = useAppDispatch(); - const accessToken = useAppSelector((state) => state.tokens.access_token); - const isLoggedIn = useAppSelector((state) => loggedIn(state)); - +function UnsuspendedPage() { + const [oauth, setOauth] = useState(false) + const dispatch = useAppDispatch() + const accessToken = useAppSelector((state) => state.tokens.access_token) + const isLoggedIn = useAppSelector((state) => loggedIn(state)) const searchParams = useSearchParams(); const router = useRouter(); @@ -249,3 +248,7 @@ export default function Page() { ); } + +export default function Page() { + return +} \ No newline at end of file diff --git a/{{cookiecutter.project_slug}}/frontend/app/page.tsx b/{{cookiecutter.project_slug}}/frontend/app/page.tsx index 12bc1a1..511e763 100644 --- a/{{cookiecutter.project_slug}}/frontend/app/page.tsx +++ b/{{cookiecutter.project_slug}}/frontend/app/page.tsx @@ -1,14 +1,13 @@ "use client"; -import { ChevronRightIcon } from "@heroicons/react/20/solid"; -import Link from "next/link"; -import { useRouter, useSearchParams } from "next/navigation"; -import { useEffect } from "react"; -import { useAppDispatch, useAppSelector } from "./lib/hooks"; -import { loggedIn, magicLogin } from "./lib/slices/authSlice"; -import { tokenIsTOTP } from "./lib/utilities"; -import { token } from "./lib/slices/tokensSlice"; - +import { ChevronRightIcon } from "@heroicons/react/20/solid" +import Link from "next/link" +import { useRouter, useSearchParams } from "next/navigation" +import { Suspense, useEffect } from "react" +import { useAppDispatch, useAppSelector } from "./lib/hooks" +import { loggedIn, magicLogin } from "./lib/slices/authSlice" +import { tokenIsTOTP } from "./lib/utilities" +import { token } from "./lib/slices/tokensSlice" const github = { name: "GitHub", href: "https://github.com/mongodb-labs/full-stack-fastapi-mongodb", @@ -28,9 +27,9 @@ const github = { const redirectTOTP = "/totp"; const redirectAfterLogin = "/"; -export default function Page() { - const router = useRouter(); - const query = useSearchParams(); +function UnsuspendedPage() { + const router = useRouter() + const query = useSearchParams() const dispatch = useAppDispatch(); @@ -180,3 +179,7 @@ export default function Page() { ); } + +export default function Page() { + return +} \ No newline at end of file diff --git a/{{cookiecutter.project_slug}}/frontend/app/reset-password/page.tsx b/{{cookiecutter.project_slug}}/frontend/app/reset-password/page.tsx index 9b739ca..0b7faae 100644 --- a/{{cookiecutter.project_slug}}/frontend/app/reset-password/page.tsx +++ b/{{cookiecutter.project_slug}}/frontend/app/reset-password/page.tsx @@ -1,11 +1,11 @@ "use client"; -import { useRouter, useSearchParams } from "next/navigation"; -import { useAppDispatch } from "../lib/hooks"; -import { useForm } from "react-hook-form"; -import { resetPassword } from "../lib/slices/authSlice"; -import { useEffect } from "react"; -import Image from "next/image"; +import { useRouter, useSearchParams } from "next/navigation" +import { useAppDispatch } from "../lib/hooks" +import { useForm } from "react-hook-form" +import { resetPassword } from "../lib/slices/authSlice" +import { Suspense, useEffect } from "react" +import Image from "next/image" const schema = { password: { required: true, minLength: 8, maxLength: 64 }, @@ -34,8 +34,8 @@ const renderError = (type: LiteralUnion) => { } }; -export default function ResetPassword() { - const dispatch = useAppDispatch(); +function UnsuspendedResetPassword() { + const dispatch = useAppDispatch() const router = useRouter(); const query = useSearchParams(); @@ -154,3 +154,7 @@ export default function ResetPassword() { ); } + +export default function ResetPassword() { + return +} \ No newline at end of file