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

nextui
Guus van Meerveld 8 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";
export const Elements: Component = ({ children }) => {
return (
<>
<Nav />
<Suspense fallback={<Nav pathname="" />}>
<NavClient />
</Suspense>
{children}
</>
);

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