question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Adding react-select to repository with theme-ui and Next.js results in broken styles for production website.

See original GitHub issue

Are you reporting a bug or runtime error?

Bug - as in title. While in development mode on localhost this issue is not visible at all.

Reproduction and investigation

Repo to reproduce: https://github.com/pacxiu/react-select-bug

For reproducing issue locally (running production build) run yarn build && yarn start

Production deployment on vercel - https://react-select-bug.vercel.app/ (You could see that on initial load for couple msec website is looking correctly, after that body element is loosing it styles eg: background and font-size)

I think it could be somehow related to the fact that both react-select and theme-ui are using emotion-css underhood? However I’m not sure at all how it is caused.

Expected

Production build shouldn’t have broken CSS styles and match what we could see locally.

Screens:

Production build:

image

Local environment

image

@edit Another hint that I’ve fround - production seems okayish with 3.2.0 version of react-select.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9

github_iconTop GitHub Comments

2reactions
pacxiucommented, Mar 18, 2021

@ebonow yeah, that was it, thanks for guiding!

1reaction
mattvb91commented, Oct 13, 2021

@ebonow I appreciate the response. I have spent the last 2 hours putting a minimum reproduction example together and everything was working fine in that along with all client loading pages.

Turns out that as soon as I added a component from this lib @react-google-maps/api then the css started breaking again for react-select on client loaded pages… Turns out this comment: https://github.com/JustFly1984/react-google-maps-api/issues/1361#issuecomment-762813572 is what helped me fix it.

Im assuming something in that library hooks into an event listener and then blocks the css from loading.

I apologise for assuming its this lib that is causing the issues but i was absolutely out of my depth with this issue (and i still am) as i dont know enough of the react depths to understand how another component can cause this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Add Theme UI to your NextJS site - DEV Community ‍ ‍
Run npm run dev (or yarn dev ) to check if the theme styles have been applied. That's it, we have added Theme...
Read more >
Master code splitting with dynamic imports in Next.js - Daily.dev
Code splitting is an optimization technique that aims to reduce the size of an app's (first) payload by splitting or breaking the code ......
Read more >
NOTICE.pdf - NetApp Cloud Central
Source Code in an information repository reasonably calculated to permit ... or consequential damages of any character arising as a result of this...
Read more >
Topic: React - MeetupFeed
JavaScript Styles in React: The Good Parts. Robert Concepción ... Add Powerful Components to Your React Apps ... SSR with Next.js and React....
Read more >
material-ui - CHANGELOG.md - GitLab
Convert 4 components to the unstyled pattern (#24985, #24857, #24890, #24957) @povilass. This change doesn't introduce any breaking changes. Hence, most of ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found