nextui-org / nextui

🚀 Beautiful, fast and modern React UI library.
https://nextui.org
MIT License
21.89k stars 1.52k forks source link

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

Open Mnigos opened 2 months ago

Mnigos commented 2 months ago

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

linear[bot] commented 2 months ago

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

wingkwong commented 2 months ago

please try it on latest version to see if it is still reproducible.

Mnigos commented 2 months ago

There is no newer version than 2.0.36 for navbar. And this is the version which I was using while submitting this issue

Mnigos commented 2 months ago

any news?

ryo-manba commented 1 month ago

use server is meant to be used for Server Actions, so it looks like it might not be used correctly.