Skip to content

Console Error: StarsCount async Client Component in site-header.tsx #69

@Codehagen

Description

@Codehagen

Bug Description

Getting a console error about an async Client Component:

<StarsCount> is an async Client Component. Only Server Components can be async at the moment. 
This error is often caused by accidentally adding `'use client'` to a module that was originally written for the server.

Error Location

src/components/site-header.tsx (31:11) @ SiteHeader

  29 |             className="ml-2 hidden h-4 lg:block"
  30 |           />
> 31 |           <GitHubLink />
     |           ^
  32 |           <Separator orientation="vertical" className="h-4" />
  33 |           <ModeSwitcher />
  34 |         </div>

Call Stack

  • SiteHeader: src/components/site-header.tsx (31:11)
  • DocsLayout: src/app/(docs)/docs/layout.tsx (13:7)

Expected Behavior

The StarsCount component should work without throwing async Client Component errors.

Possible Solution

The StarsCount component inside GitHubLink might be marked as a Client Component but is using async/await. This needs to be refactored to either:

  1. Make it a Server Component by removing 'use client'
  2. Move the async logic to a Server Component wrapper
  3. Use client-side data fetching (useEffect/SWR/React Query) instead of async/await

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions