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

Improvement: Rework the static initialisation through Flags #39

Open
fpapado opened this issue Jul 11, 2019 · 0 comments
Open

Improvement: Rework the static initialisation through Flags #39

fpapado opened this issue Jul 11, 2019 · 0 comments

Comments

@fpapado
Copy link
Owner

fpapado commented Jul 11, 2019

There are some things that help the app start without flashes of content:

  • Is it dark mode? Less flashing of the map when loading, anything that relies on DarkMode (not many things do; it's in the cascade from the root)
  • Has the user interacted with the app? Then we don't need to show the pitch. Currently, we flash the pitch if the user has not interacted, which I find a bit distracting.

The main dilemma here:
Not waiting for (localstorage, indexedDB) allows us to paint faster. How fast or slow are those? IndexedDB being asynchronous could be used to unblock paint, but the flashes seem worse, maybe? Furthermore, can we synchronously set dark mode on the page? Currently we get a flash from light to dark on load.

One approach to dark mode:

  • Synchronously store user preferences in localstorage
  • Get that inline in the <head>, using the user preferences

The downside to that is blocking the parser, leading to a slower first paint.

A more modest approach:

  • Use an a media-query to pick initial light/dark mode
  • Give higher priority to .light-mode/.dark-mode

The assumption there is that if the user has light/dark mode, then it is more likely to sync with their preference.

Either way, I think we should be handling at least the userHasInteractedWithApp in the initialisation!

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

No branches or pull requests

1 participant