Skip to content
Discussion options

You must be logged in to vote

I see, that's because you are passing the icons as functions, and functions can not get passed from server to client components as they are not serializable.

In this case, you can keep AppSidebar a client component, and instead move data fetching to the parent server component.

In your case, app/cabinet/layout.tsx.
Fetch admin there and pass it to the sidebar.

export default async function Layout({
  children,
}: {
  children: React.ReactNode;
}) {
  const admin = await getAdmin();

  return (
    <SidebarProvider>
      <AppSidebar variant="inset" admin={admin} />
      ...
    </SidebarProvider>
  );
}
"use client"

...

export function AppSidebar({ admin, ...props }) {
  ...
}

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@abdulazizkhatamov
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by abdulazizkhatamov
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants