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.

Emotion example is poorly performant, re-rendering over 50 times a second

See original GitHub issue

What version of Remix are you using?

1.2.3

Steps to Reproduce

  1. Download the example app:
$ svn export https://github.com/remix-run/remix/tree/main/examples/emotion
  1. Install dependencies
  2. Log style re-render trigger:
$ vim app/entry.client.tsx # Add `console.log("🚨 RERENDER 🚨")` in `reset()` function body
  1. Run app:
$ npm run dev
  1. Look at the console: Browser console screenshot (clipped)

This is not only re-applying the style tags, but also re-rendering the entire app tree over 50 times a second, which isn’t good at all. See my comment below for a suggestion on how to combat this problem.

Expected Behavior

A fast app

Actual Behavior

An app that is flooded with console warnings and re-renders

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:30 (1 by maintainers)

github_iconTop GitHub Comments

4reactions
chaancecommented, Oct 20, 2022

If someone would like to update the emotion example to mirror this chakra example that would be awesome: #35

Emotion supports SSR with streaming and we should be using their native helpers instead of trying to hack our own solutions: https://emotion.sh/docs/ssr#renderstylestonodestream

I plan on knocking this out today 🙂

2reactions
chaancecommented, Nov 18, 2022

I’ve been meaning to do this but it fell to the bottom of my to-do list. I’ll try to get back on it next week if no one else beats me to it 😅

Read more comments on GitHub >

github_iconTop Results From Across the Web

Just Say No to Excessive Re-Rendering in React - GrapeCity
In this article, we will address instances of excessive re-rendering in React applications and demonstrate how to avoid them.
Read more >
When does React re-render components? - Felix Gerschau
React re-rendering explained and how to optimize React's re-render performance.
Read more >
Untitled
The second user study investigates the emotional component and how it can be ... A large body of research on children's cognitive and...
Read more >
David and Daniel discuss the Comet and Ajax implementation in Lift.
@djspiewak @dpp If there was a well-known method to xferring state b/n client and ... Let's look at another example more obvious in...
Read more >
Luke v. State, Court of Appeals Case No. 19A-CR-2229 | Casetext ...
On appeal, Luke contends that the trial court should have excluded testimony from the State's handwriting and fingerprint examiners, as well as State's ......
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