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 · 3 comments
Labels
help wanted Extra attention is needed

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

@jbccollins
Copy link
Author

@arjunvegda Doing a bit more testing locally, this only happens for me when I switch the devtools to use dark mode. After that it happens on every page refresh. Could you give that a try and if you still can't reproduce I can make a stackblitz?

@arjunvegda
Copy link
Member

Thanks! That caused it to throw an error. The error appears to come from Mantine. Do you want to take a stab at it? Perhaps we could create a small repro (without Jotai DevTools) and report it to Mantine. 🤔

@arjunvegda arjunvegda added the help wanted Extra attention is needed label Jul 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants