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

Jotai Devtools spits out a mismatched server/client props warning when used in Nextjs 14 #155

Open
jbccollins opened this issue Jul 2, 2024 · 1 comment

Comments

@jbccollins
Copy link

Warning: Prop style did not match. Server: "--ai-radius:50%;--ai-bg:var(--mantine-color-dark-filled);--ai-hover:var(--mantine-color-dark-filled-hover);--ai-color:var(--mantine-color-white);--ai-bd:calc(0.0625rem * var(--mantine-scale)) solid transparent;border-width:0;z-index:99999;width:calc(4rem * var(--mantine-scale));height:calc(4rem * var(--mantine-scale));position:fixed;top:unset;left:0.2rem;bottom:0.2rem;right:unset" Client: "--ai-radius:50%;--ai-bg:var(--mantine-color-gray-3);--ai-hover:var(--mantine-color-gray-4);--ai-color:var(--mantine-color-white);--ai-bd:calc(0.0625rem * var(--mantine-scale)) solid transparent;border-width:0;z-index:99999;width:calc(4rem * var(--mantine-scale));height:calc(4rem * var(--mantine-scale));position:fixed;top:unset;left:0.2rem;bottom:0.2rem;right:unset"

store/index.ts

import { createStore } from 'jotai';

const store = createStore()

export default store;

ClientProviders.tsx

"use client";

import store from "@/store";
import { Provider } from "jotai";
import { DevTools  } from "jotai-devtools";
import { ReactNode } from "react";

import "jotai-devtools/styles.css";

export default function ClientProviders({ children }: { children: ReactNode }) {
  return (
    <Provider store={store}>
      <DevTools store={store} />
      {children}
    </Provider>
  );
}

layout.tsx

import ClientProviders from "@/providers/ClientProviders";
import "./globals.css";

export default function RootLayout({
  children,
}: Readonly<{
  children: React.ReactNode;
}>) {
  return (
    <html lang="en">
      <body className={inter.className}>
        <ClientProviders>{children}</ClientProviders>
      </body>
    </html>
  );
}
@arjunvegda
Copy link
Member

arjunvegda commented Jul 7, 2024

Thanks for reporting. I can't reproduce this locally on my end. Could you please create a repro on Stackblitz?
image

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

No branches or pull requests

2 participants