Skip to content

Bug Title: HeroUI Select Component Fails in Both Client and Server Components #5306

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
hanzlahabib opened this issue May 19, 2025 · 2 comments

Comments

@hanzlahabib
Copy link

Environment:

Steps to Reproduce:

  1. Try using Select component in any Next.js page (both client and server components)
  2. Import and use Select with SelectItem children

Error Stack Trace:
Error: Unknown element <[object Object]> in collection.
at $eb2240fc39a57fa5$export$bf788dd355e3a401.getFullNode
at getFullNode.next
at $eb2240fc39a57fa5$export$bf788dd355e3a401.iterateCollection
at iterateCollection.next
at [Symbol.iterator]
at Generator.next
at new $a02d57049d202695$export$d085fb9e920b5ca7
at eval
at eval
at mountMemo
at Object.useMemo
at exports.useMemo
at $7613b1592d41b092$export$6cd28814d92fa9c9
at $e72dd72e1c76a225$export$2f645645f7bca764
at useMultiSelectListState
at useMultiSelectState
at useSelect
at Select2

Code Examples:

  1. Direct usage in page:
// In any Next.js page
import { Select, SelectItem } from '@heroui/react'

export default function Page() {
    return (
        <Select>
            <SelectItem key="option1">Option 1</SelectItem>
            <SelectItem key="option2">Option 2</SelectItem>
        </Select>
    )
}
  1. Client Component usage:
'use client'
import { Select, SelectItem } from '@heroui/react'

export function ClientSelect() {
    return (
        <Select>
            <SelectItem key="option1">Option 1</SelectItem>
            <SelectItem key="option2">Option 2</SelectItem>
        </Select>
    )
}

Both approaches result in the same error.

Attempted Solutions:

  1. Used component directly in page (failed)
  2. Created client component with 'use client' directive (failed)
  3. Tried different ways of passing children
  4. Tried using SelectSection
  5. Tried different props combinations

Current Workaround:
Had to create a custom select component using native HTML select element instead of using HeroUI's Select component.

Additional Notes:

  • The error occurs in both client and server components
  • The error is coming from HeroUI's internal dependencies (@react-stately)
  • The issue is not related to Next.js server/client components, as it fails in both cases
  • This is a critical issue as it makes the Select component completely unusable
Copy link

linear bot commented May 19, 2025

@wingkwong
Copy link
Member

can you provide a sandbox? it looks fine on my side.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants