The page was being rendered during the async router.replace call (#306)

* The page was being rendered during the async router.replace call

* Adding a different, slightly smaller fix
This commit is contained in:
Alex van Andel 2021-06-24 14:46:35 +01:00 committed by GitHub
parent ebb3e87284
commit 5334c350e2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -32,11 +32,9 @@ export default function Shell(props) {
if (!loading && !session) { if (!loading && !session) {
router.replace("/auth/login"); router.replace("/auth/login");
} else if (loading) {
return <p className="text-gray-400">Loading...</p>;
} }
return ( return session ? (
<div> <div>
<div className="bg-gradient-to-b from-blue-600 via-blue-600 to-blue-300 pb-32"> <div className="bg-gradient-to-b from-blue-600 via-blue-600 to-blue-300 pb-32">
<nav className="bg-blue-600"> <nav className="bg-blue-600">
@ -271,5 +269,5 @@ export default function Shell(props) {
<div className="max-w-7xl mx-auto pb-12 px-4 sm:px-6 lg:px-8">{props.children}</div> <div className="max-w-7xl mx-auto pb-12 px-4 sm:px-6 lg:px-8">{props.children}</div>
</main> </main>
</div> </div>
); ) : null;
} }