Skip to content
This repository was archived by the owner on Dec 16, 2025. It is now read-only.
This repository was archived by the owner on Dec 16, 2025. It is now read-only.

Flash of unstyled content when loading from server #75

Closed as not planned

Description

@1a57danc3

Screen Shot 2022-09-28 at 11 50 00

Screen Shot 2022-09-28 at 11 49 53

When the page is opened, the page layout is normal, why the page is re-rendered once again.

EUI v63.0.0 is normal, All new versions have this problem.

Activity

  1. 1a57danc3 commented on Sep 28, 2022

    @1a57danc3
    Author
  2. changed the title [-]Page layout rending issue in EUI new version[/-] [+]Page layout rendering issue in EUI new version[/+] on Sep 28, 2022
  3. elizabetdev commented on Sep 28, 2022

    @elizabetdev
    Contributor

    Hi @h0wardch3ng,

    Can you try to replicate the issue with a CodeSandbox?

    You can clone this repo https://github.com/elastic/next-eui-starter

    Change some components to test this issue.

    The next-eui-starter is currently using "@elastic/eui": "^55.1.0" as you can see in the package.json. So is this issue happening on EUI version 55.1.0?

    EUI v63.0.0 is normal, All new versions have this problem.

    So is this issue happening after v63.0.0? I'm a bit confused. A CodesandBox would be helpful.

  4. 1a57danc3 commented on Sep 29, 2022

    @1a57danc3
    Author

    @miukimiu

    https://github.com/h0wardch3ng/eui-rendering-issue

    pnpm install

    pnpm run build

    pnpm run start

    You can use this to test this bug, thanks

  5. cee-chen commented on Sep 30, 2022

    @cee-chen

    Pinging @chandlerprall on this one as a perf/rerender expert :)

  6. 1a57danc3 commented on Sep 30, 2022

    @1a57danc3
    Author

    Thanks @constancecchen


    @miukimiu EUI versions higher than v63.0.0 all have this rendering problem.

  7. chandlerprall commented on Oct 3, 2022

    @chandlerprall
    Contributor

    I've been able to reproduce (more or less) the devtools screenshot in both the eui-rendering-issue and next-eui-starter repos. I believe the styled->unstyled->styled changes is an artifact of running the performance audit starting with the existing (styled) page, reloading, and applying styles. I tested this two ways:

    • manipulate the page before executing the audit, in the screenshots I see the manipulated version, then flash of unstyled+reloaded app, then styling
    • turn off the server & load the "This site can't be reached" error page; start the server and then start the audit: I see the error page, then flash of unstyled+reloaded app, then styling

    This leads me to think the root issue is around next+emotion+server-side-rendering. That is supposed to Just Work out of the box since Emotion v10 but I bet EUI's custom emotion cache targets is interfering.

    @h0wardch3ng if this sounds accurate to you, I will move this issue over to the next-eui-starter repo.

  8. 1a57danc3 commented on Oct 8, 2022

    @1a57danc3
    Author

    @chandlerprall
    Sorry for my late reply.
    Currently the solution to this problem, we are still stuck in the old version, I hope the EUI team can solve this rendering problem, Thanks for your detailed answer.

  9. transferred this issue fromelastic/euion Oct 24, 2022
  10. changed the title [-]Page layout rendering issue in EUI new version[/-] [+]Flash of unstyled content when loading from server[/+] on Oct 24, 2022
  11. Chetan11-dev commented on Feb 10, 2023

    @Chetan11-dev

    What is the Solution to Problem?

  12. self-assigned this
    on Feb 21, 2023
  13. removed their assignment
    on Apr 28, 2023
  14. b0r1sp commented on Sep 13, 2023

    @b0r1sp

    Bump :-)
    Renders the purpose of this repo for an easy-start as useless from my point of view.
    Please at least give some hints to fix that or provide a status.. thank you so much!

  15. Chetan11-dev commented on Sep 13, 2023

    @Chetan11-dev

    To fix this Problem Please run following Command and there will not be flashes of unstyled content

    yarn add @elastic/eui@^63.0.0
    yarn dev
    
  16. caseydlvr commented on Sep 15, 2023

    @caseydlvr

    @Chetan11-dev What happened to the forked repository that supposedly fixed the issue? The repo appears to gone and your comment edited to specify using 63.0.0 to fix the problem. The fact that we're stuck on 63.0.0 is the problem.

  17. Chetan11-dev commented on Sep 15, 2023

    @Chetan11-dev

    The fork also just changes the elastic ui version to 63.
    I believe it will be easier for people to just run the command instead of using a fork.
    Additionally I have been using elastic ui 63 for 4 month+ in production and didn't face any issue.
    There is not much difference in components provided by elastic ui 63 and 68. So you can safely use 63.

  18. b0r1sp commented on Sep 15, 2023

    @b0r1sp

    The fork also just changes the elastic ui version to 63.
    I believe it will be easier for people to just run the command instead of using a fork.

    Agree, thank you.
    Nevertheless, maybe @chandlerprall can give advice how to fix the root cause of this problem.

  19. caseydlvr commented on Sep 15, 2023

    @caseydlvr

    The fork also just changes the elastic ui version to 63. I believe it will be easier for people to just run the command instead of using a fork. Additionally I have been using elastic ui 63 for 4 month+ in production and didn't face any issue. There is not much difference in components provided by elastic ui 63 and 68. So you can safely use 63.

    Ahh I see your intention now. In terms of going from a fresh clone of this repo to a working version, yes I agree that's an easier solution than a fork. But I think at this point a lot of us are already on 63.0.0 (as mentioned in the OP) and are hoping for a solution for upgrading past that. EUI is currently on version 88.3.0 and we're getting left behind.

  20. tkajtoch commented on Sep 19, 2023

    @tkajtoch

    We plan to update next-eui-starter to the latest Next.js and EUI versions within the next few weeks and provide a fix for the flash of unstyled text bug.

    The bug is caused by EUI's Emotion styles not being properly extracted and injected into the document's <head> when rendering on the server side.

    For anyone looking for an immediate solution, I recommend following the code in https://github.com/haukurmar/next-13-appdir-with-emotion/tree/master repository and passing the custom EmotionCache instance to EUI by using <EuiProvider cache={registry.cache}> here.

  21. nhatpham0709 commented on Nov 13, 2023

    @nhatpham0709

    What's the update on this guys? Really looking forward to this cause next 14 is becoming more stable than ever

  22. removed their assignment
    on Apr 2, 2024
  23. JasonStoltz commented on Dec 15, 2025

    @JasonStoltz
    Contributor

    Closing this old issue as it has gone stale. Feel free to re-open it if you feel it is still important.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions