salimi-my / shadcn-ui-sidebar

A stunning, functional and responsive retractable sidebar for Next.js built on top of shadcn/ui.
https://shadcn-ui-sidebar.salimi.my
MIT License
744 stars 90 forks source link

Cannot update a component (`HotReload`) #4

Closed geoffreygarrett closed 2 months ago

geoffreygarrett commented 2 months ago

Encountered the following error:

Cannot update a component (`HotReload`) while rendering a different component (`Router`). To locate the bad setState() call inside `Router`, follow the stack trace as described in 

In a server page as simple as:

export default async function PublicPage() {
  return redirect(`/`);
}

When it was wrapped by the admin layout. The error was not obvious to me so it took a few hours, but the issue was the state management:

https://github.com/salimi-my/shadcn-ui-sidebar/blob/c2ef61d33b31a09f143473dfeb4f17cecd2fd183/src/components/admin-panel/admin-panel-layout.tsx#L14

My project is already large, so it wasn't clear the issue was the above link, and I haven't confirmed with a minimal reproducible example, but it might be worthwhile checking it out.

salimi-my commented 2 months ago

There isn't much I can do without a reproduction. Like you said yourself, it wasn't clear what is the exact issue here so I can't analyze and understand the specific issue you are facing. Please do provide a reproduction later if you can. Meanwhile, this issue will closed.