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

App load tweaks #12869

Merged
merged 10 commits into from
Mar 26, 2020
Merged

App load tweaks #12869

merged 10 commits into from
Mar 26, 2020

Conversation

t3chguy
Copy link
Member

@t3chguy t3chguy commented Mar 25, 2020

This PR pulls some of the simpler stuff out of my larger changeset and paves the work for code-splitting by grouping loading code better. It also converts some stuff to TypeScript. This set of changes does not yet impact bundle size.

Fundamentally (but not yet split):

  • index.js should be as safe and as small as possible
  • init.ts should be as light as possible but if it crashes, index.js will show an error
  • app.js will load the rest of the app.

The app will later be as preloaded as possible to make the best use of HTTP/2 fetch parallelism.

image

… time

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
…vector-im/riot-web into t3chguy/app_load_tweaks
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
@t3chguy t3chguy marked this pull request as ready for review March 25, 2020 14:14
@t3chguy t3chguy requested a review from a team March 25, 2020 14:14
…vector-im/riot-web into t3chguy/app_load_tweaks
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
@bwindels bwindels requested review from bwindels and removed request for a team March 26, 2020 10:32
Copy link
Contributor

@bwindels bwindels left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code looks good, just one suggestion. I'm not entirely sure how code-splitting will benefit us though, as I suspect that the big bundles will still change every release? What are the chunks we want to eventually end up with? Perhaps this is related to Travis' Jitsi work? I'm not really aware of the details of that.

Would also be great to document this, but I can imagine you've already got that planned in the follow-up PRs.

configSyntaxError = true;
configJson = {}; // to prevent errors between here and loading CSS for the error box
}
return e;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess you return rather than throw the error here to receive the error without a try/catch in app.js:190. Returning errors from a promise is rather non-idiomatic though. Can I suggest to do it the more straight-forward way and throw and catch?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean that's exactly what this code did previously as per Travis' doing except it was returning an error and a boolean

This comment was marked as duplicate.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, yeah, missed that it was already there. Not sure how returning rather than throwing will allow first paint sooner but not too big of a deal, I'm fine either way.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

commented that in the wrong place

@t3chguy
Copy link
Member Author

t3chguy commented Mar 26, 2020

I'm not entirely sure how code-splitting will benefit us though, as I suspect that the big bundles will still change every release?

Possibly but reusable chunks between entrypoints and also just the sanity of loading, so we can not import code which uses things like localStorage until we have ran modernizr etc.

@t3chguy
Copy link
Member Author

t3chguy commented Mar 26, 2020

it just gives a better progression to the app load, means first paint is sooner.

@bwindels
Copy link
Contributor

I'm not entirely sure how code-splitting will benefit us though, as I suspect that the big bundles will still change every release?

Possibly but reusable chunks between entrypoints and also just the sanity of loading, so we can not import code which uses things like localStorage until we have ran modernizr etc.

I see, ok 👍

@bwindels
Copy link
Contributor

I guess I'm just a bit worried of further complicating our webpack setup, but given we already have async components, this doesn't add much complexity? Wdyt?

@t3chguy
Copy link
Member Author

t3chguy commented Mar 26, 2020

It doesn't add any webpack-level complexity, its just the use of dynamic-imports and webpack optimizes where the splits happen

@bwindels bwindels self-requested a review March 26, 2020 11:44
@t3chguy t3chguy merged commit 1d109bb into develop Mar 26, 2020
@t3chguy t3chguy deleted the t3chguy/app_load_tweaks branch May 12, 2022 09:07
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