Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve first meaningful paint on browser #309

Merged
merged 1 commit into from
Apr 2, 2018

Conversation

ianwang
Copy link
Contributor

@ianwang ianwang commented Apr 1, 2018

Before (~2s)

screen shot 2018-04-02 at 00 41 58

After (~1s)

screen shot 2018-04-02 at 00 41 10

☝️ both are tested on localhost (Chrome v65.0)
the green line is the first frame captured.

Description

speed up by delaying codemirror theme & highlightjs (big lib)

@mfix22
Copy link
Contributor

mfix22 commented Apr 1, 2018

Hey @ianwang this is great! As for checking if rendering if occurring inBrowser, are you sure this isn't causing a rerender due to a client-server mismatch (should have a warning in the console).

A way to avoid this is to just set state.mounted: true after componentDidMount() and render based on this.state.mounted === true

@ianwang
Copy link
Contributor Author

ianwang commented Apr 1, 2018

@mfix22 yes I was expecting that, but interestingly I didn't see any warning about the mismatch.
maybe it's because React 16 changes the algo? or it's because of the implementation of next/head.

@mfix22
Copy link
Contributor

mfix22 commented Apr 2, 2018

Interesting. Okay well if i see it later i'll know where to look! 😄 Thanks so much.

@mfix22 mfix22 merged commit 6bf64a6 into carbon-app:master Apr 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants