Skip to content
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

chore: add note about hydration warning for next-themes #503

Merged
merged 2 commits into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/thin-flowers-prove.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@premieroctet/next-admin-cli": patch
---

chore: add extra instructions for app router
8 changes: 7 additions & 1 deletion apps/docs/pages/docs/getting-started.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ Next-Admin uses a dynamic route `[[...nextadmin]]` to handle all the admin route
export default async function AdminPage({
params,
searchParams,
}: PageProps) {
}: PageProps) { // or PromisePageProps for Next 15+
const props = await getNextAdminProps({
params: params.nextadmin,
searchParams,
Expand All @@ -135,6 +135,12 @@ Next-Admin uses a dynamic route `[[...nextadmin]]` to handle all the admin route
Make sure to not use `use client` in the page.
</Callout>

<Callout emoji="⚠️">
Because we are using [next-themes](https://github.com/pacocoursey/next-themes) to handle dark mode,
you will need to add the `suppressHydrationWarning` to your the closest `<html>` tag of the admin page.
See [the next-themes docs](https://github.com/pacocoursey/next-themes?tab=readme-ov-file#with-app)
</Callout>

</Tabs.Tab>
<Tabs.Tab>

Expand Down
8 changes: 7 additions & 1 deletion packages/cli/src/commands/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,13 @@ experimental: {
extraInstructions = `You will need to do the following manually:
- ${usesBabel ? `${packageManagerData.name} ${packageManagerData.installDevCmd} babel-plugin-superjson-next superjson@^1` : `${packageManagerData.name} ${packageManagerData.installDevCmd} next-superjson-plugin superjson`}
- ${superjsonInstructions}
- Add "@premieroctet/next-admin" to your transpilePackages array in the Next.js configuration file
- Add "@premieroctet/next-admin" to your transpilePackages array in the Next.js configuration file
`;
}

if (routerRootPath.type === "app") {
extraInstructions = `You will need to do the following manually:
- Add the suppressHydrationWarning prop to the closest <html> tag for the admin page
`;
}

Expand Down
Loading