davidhu2000 / react-spinners

A collection of loading spinner components for react
https://www.davidhu.io/react-spinners
MIT License
3k stars 260 forks source link

'Prop 'style' did not match. ' after updating to 0.14.0 #604

Closed wowtah closed 6 days ago

wowtah commented 1 week ago

"react-spinners": "^0.14.0", "next": "^14.2.4",

Warning: Prop 'style' did not match. 

Server: "background-color:#000000;width:4px;height:35px;margin:2px;border-radius:2px;display:inline-block;animation:react-spinners-ScaleLoader-scale-21by5e1Ih4 1s 0.1s infinite cubic-bezier(0.2, 0.68, 0.18, 1.08);animation-fill-mode:both" 

Client: "background-color:#000000;width:4px;height:35px;margin:2px;border-radius:2px;display:inline-block;animation:react-spinners-ScaleLoader-scale-Omqqj0XidA 1s 0.1s infinite cubic-bezier(0.2, 0.68, 0.18, 1.08);animation-fill-mode:both"

Describe the bug It works in 0.13.8, after updating to 0.14.0 I get this error in the browser console. I use NextJS 14.

To Reproduce

"use client"

import { ScaleLoader as Loader } from "react-spinners";

...

<div className="fixed left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2">
        <Loader color="#000000" />
      </div>

Expected behaviour

Maybe it should not render on the server if the component is marked as "use client" ? And if its unavoidable, I guess they should render the same?

davidhu2000 commented 1 week ago

i added that to fix this issue, https://github.com/davidhu2000/react-spinners/pull/602, probbaly should revert and deprecate this version.

when i have more time, will need to spent some thing figure out nextjs and the new client/server primitives.

davidhu2000 commented 1 week ago

@wowtah try 0.14.1.

wowtah commented 6 days ago

@wowtah try 0.14.1.

That worked! Thanks :)