styled-components: Client style missing on hydration after SSR (V5)
Environment
## System:
- OS: macOS High Sierra 10.13.4
- CPU: (4) x64 Intel(R) Core(TM) i7-6567U CPU @ 3.30GHz
- Memory: 82.61 MB / 16.00 GB
- Shell: 3.2.57 - /bin/bash
## Binaries:
- Node: 8.12.0 - ~/.nvm/versions/node/v8.12.0/bin/node
- Yarn: 1.6.0 - /usr/local/bin/yarn
- npm: 6.4.1 - ~/.nvm/versions/node/v8.12.0/bin/npm
- Watchman: 4.7.0 - /usr/local/bin/watchman
## npmPackages:
- babel-plugin-styled-components: ^1.10.6 => 1.10.6
- styled-components: ^5.0.0-beta.9 => 5.0.0-beta.9
Reproduction
Sandbox 1 (expressJS setup) https://codesandbox.io/s/example-server-side-rendering-fsq6v Sandbox 2 (nextJS setup) https://codesandbox.io/s/next-styled-component-v5-style-mismatch-0n0qk
Steps to reproduce
Set up a simple button component with a gradient border.
Expected Behavior
SSR will render the gradient and upon hydration, the client will keep the gradient.
Actual Behavior
SSR will render the gradient and upon hydration, the border styling is removed.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 42 (24 by maintainers)
Can you unpublish
styled-components@5.0.0-regexrehydrate
. It’s being recommended as an upgrade overstyled-components@5.0.0-rc.2
by renovate.This is fixed in beta 11, apologies!
5.0.0-regexrehydrate
That’s an old version from before the RCs. Please just use the “beta” tag in your package json.
On Wed, Jan 8, 2020 at 4:01 AM Pierre Bondoerffer notifications@github.com wrote:
@probablyup as far as I can tell, the branch fixes the issue
I’m working on a regex-based fix for this, going to try and get a PR up tonight
@rtymchyk oh rehydration was totally rewritten for v5, that’s part of the reason for our performance gains over v4
More interesting… it’s correct in Safari and Edge, and wrong in Chrome and Firefox… oy vey lol. So it seems there are vendor-specific bugs in the implementation that we’re catching the end of.
cc @kitten
I’ve been digging into this and it appears to be an issue with reading back out of CSSOM.
cssRule.cssText
doesn’t like that border image syntax for some reason… I’m fiddling around with it.Ah right, sorry there have been a lot of similar but slightly different issues around this topic and I got confused.
@probablyup I can confirm, that the bug has been fixed for me with v11. Thanks for your work!