nav: fix suspense not having fallback
continuous-integration/drone/push Build is failing Details

nextui
Guus van Meerveld 2 months ago
parent 9f04f1b96a
commit 7db6022749

@ -1,13 +1,17 @@
"use client"; import { Suspense } from "react";
import { Nav } from "@/components/Nav"; import { Nav } from "@/components/Nav/Nav";
import { NavClient } from "@/components/Nav/NavClient";
import { Component } from "@/typings/component"; import { Component } from "@/typings/component";
export const Elements: Component = ({ children }) => { export const Elements: Component = ({ children }) => {
return ( return (
<> <>
<Nav /> <Suspense fallback={<Nav pathname="" />}>
<NavClient />
</Suspense>
{children} {children}
</> </>
); );

@ -1,7 +1,5 @@
"use client";
import NextLink from "next/link"; import NextLink from "next/link";
import { usePathname } from "next/navigation"; import { FC } from "react";
import { Button } from "@nextui-org/button"; import { Button } from "@nextui-org/button";
import { Link } from "@nextui-org/link"; import { Link } from "@nextui-org/link";
@ -12,13 +10,11 @@ import {
NavbarItem NavbarItem
} from "@nextui-org/navbar"; } from "@nextui-org/navbar";
import { Component } from "@/typings/component";
// import { Search } from "./Search"; // import { Search } from "./Search";
export const navHeight = 64; export const navHeight = 64;
export const Nav: Component = () => { export const Nav: FC<{ pathname: string }> = ({ pathname }) => {
const navItems = [ const navItems = [
{ {
title: "Trending", title: "Trending",
@ -34,8 +30,6 @@ export const Nav: Component = () => {
} }
]; ];
const pathname = usePathname();
return ( return (
<Navbar> <Navbar>
<NavbarBrand> <NavbarBrand>

@ -0,0 +1,12 @@
"use client";
import { usePathname } from "next/navigation";
import { FC } from "react";
import { Nav } from "./Nav";
export const NavClient: FC = () => {
const pathname = usePathname();
return <Nav pathname={pathname} />;
};
Loading…
Cancel
Save