TysonMN / tysonmn.github.io

Blog of Tyson Williams about software engineering and functional programming
https://tysonwilliams.coding.blog/
MIT License
3 stars 7 forks source link

Optimize loading of utterance #21

Open TysonMN opened 3 years ago

TysonMN commented 3 years ago

When a blog post is loaded, the current behavior is that utterance fetches data from GitHub twice: once for the light theme and once for the dark theme. Of course the fetched data is the same in both cases. One the positive side, switching between themes does not cause utterance to fetch any more data from GitHub.

This is not ideal. Theme switches are rare, so the performance on load is the case to optimize.

Better behavior is to fetch data from GitHub once on page load and once each time the theme is switched. Even better behavior is to fetch data once from GitHub on page load, once from GitHub on the first theme switch, and no more fetches on additional theme switches. Best behavior is to fetch data from GitHub once on page load and then never again on any theme switch.

See https://github.com/utterance/utterances/issues/427 for how decided to handle this situation.