next.js icon indicating copy to clipboard operation
next.js copied to clipboard

Styles rendering different between SSR/CSR

Open FrancosLab opened this issue 9 years ago • 1 comments

Noticed a css bug/difference between SSR and CSR, when toggling javascript on and off. CSS is being rendered backwords or incorrectly. Also using import 'glamor/reset' seems to cause double reset stylesheets.

Here is the component and styles. https://gist.github.com/FrancosLab/6627597a0df0a9467a5c5f8b4e6e2cd7

Edit, there's a work around for the gist above

  const baseStyles = styles;
  const secondaryStyles = layout === 'rtl' ? rtlStyles : {}
  const css = merge(baseStyles, secondaryStyles);

Only SSR with javascript off. (incorrect) ssr

With Javascript. (correct) js

FrancosLab avatar Dec 16 '16 04:12 FrancosLab

We don't recommend using of glamor reset as you would have to do it per-page anyways. Please look at the global styles wiki page: https://github.com/zeit/next.js/wiki/Global-styles-and-layouts

rauchg avatar Dec 16 '16 22:12 rauchg