nextui icon indicating copy to clipboard operation
nextui copied to clipboard

[BUG] - components don't work with `use server` directive

Open Mnigos opened this issue 6 months ago • 4 comments

NextUI Version

2.4.2

Describe the bug

navigation-bar.tsx

'use server'

import {
  Navbar,
  NavbarBrand,
  NavbarContent,
  NavbarItem,
} from '@nextui-org/navbar'

import { SignInButton } from './sign-in-button'
import { UserDropdown } from './user-dropdown'

import { auth } from '@app/auth'

export async function NavigationBar() {
  const session = await auth()

  return (
    <Navbar>
      <NavbarBrand className="text-primary font-bold">TaskLeafy</NavbarBrand>
      <NavbarContent justify="end">
        <NavbarItem>
          {session?.user ? (
            <UserDropdown user={session.user} />
          ) : (
            <SignInButton />
          )}
        </NavbarItem>
      </NavbarContent>
    </Navbar>
  )
}

error

 ⨯ Error: Could not find the module "/Users/igormakowski/Documents/repositories/taskleafy/app/components/user-dropdown.tsx#UserDropdown" in the React Client Manifest. This is probably a bug in the React Server Components bundler.

Your Example Website or App

No response

Steps to Reproduce the Bug or Issue

try to use Navbar component with use server directive

Expected behavior

should not throw error

Screenshots or Videos

No response

Operating System Version

macOS

Browser

Chrome

Mnigos avatar Aug 10 '24 08:08 Mnigos