styled-components: Chrome 129 caused some of styled components to have missing styles

Environment

System:

  • OS: macOS 14.1.1
  • CPU: (10) arm64 Apple M1 Pro
  • Memory: 84.19 MB / 16.00 GB
  • Shell: 5.9 - /bin/zsh

Binaries:

  • Node: 20.14.0 - ~/.nvm/versions/node/v20.14.0/bin/node
  • Yarn: 1.22.22 - ~/.yarn/bin/yarn
  • npm: 10.7.0 - ~/.nvm/versions/node/v20.14.0/bin/npm
  • pnpm: 7.9.5 - ~/Library/pnpm/pnpm

npmPackages:

  • styled-components: 6.1.0 => 6.1.0

Reproduction

I couldn’t provide the reproduction code or repo in on codesandbox with a simple setup. This might happen due to how the our app behaves

Steps to reproduce

After upgrading to Chrome 129, some of our users have started reporting UI glitches in parts of our application. We use Next.js 14.1.1 with styled-components v6, serving it as a static export and through AWS CloudFront. Many of our applications using the same setup have begun experiencing random UI glitches with missing styles. The issue does not occur in other browsers like Safari, Firefox, or earlier versions of Chrome. The classnames are present some of style rules are missing so part of UI are not properly displayed

Most of the time, the UI loads incorrectly. Refreshing the page multiple times sometimes results in the UI displaying correctly. (very rare cases, maybe 1 of 20-30 times it loads fine)

A somewhat random fix was to add <StyleSheetManager enableVendorPrefixes>, which almost resolved the issue. Now, the problem occurs approximately 1 out of every 20 times, whereas before, it loaded correctly more consistently.

CleanShot 2024-09-19 at 14 26 46@2x

PS: We tried adding the following code https://github.com/vercel/next.js/blob/canary/examples/with-styled-components/pages/_document.tsx, but that didn’t help

//  next.config.js config used

 compiler: {
    styledComponents: true,
  },

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Reactions: 25
  • Comments: 17

Most upvoted comments

Looks like Chrome just released a fix for this problem.

See https://issues.chromium.org/issues/367758074

Try running with:

/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --js-flags=--no-maglev-optimistic-peeled-loops

To see if it helps.

See https://issues.chromium.org/issues/367758074

Try running with:

/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --js-flags=--no-maglev-optimistic-peeled-loops

To see if it helps.

Yeah, it resolves the issue!

We had this in September as well, and since the new Chrome it’s back. 131.0.6778.70 (Official Build) (arm64)

I wrote in the Chromium issues platform with more information, however as this seems particular to styled-components, I’m wondering if this could be investigated from this side as well?

Next 14.2.10 Styled-components 6.1.12 React 18.3.1 Yarn 1.22.22

UPDATE: For anyone else experiencing this, I’ve a new ticket with Chrome: https://issues.chromium.org/issues/379758212 and they’re looking.

issue is fixed for us in latest version of Chrome:

Version 129.0.6668.71