ProjectSidewalk / SidewalkWebpage

Project Sidewalk web page
http://projectsidewalk.org
MIT License
84 stars 25 forks source link

Reduce Admin Page Initial Load Time by ~10s (Seattle) by Moving Coverage Data to new API Route #3707

Closed srihariKrishnaswamy closed 3 weeks ago

srihariKrishnaswamy commented 4 weeks ago

Working towards #380

I called that API route in Admin.js and loaded that data onto the Admin page after its initial load from the server. I also made it so that the spinner stops the loading animation only after that API call happens so we won't get any proxy errors, but everything will still be loaded once the spinner stops.

This reduces the initial load time of the page by ~10 seconds, but the total load time remains the same since that data is queried after the initial page load. I have the Seattle database, but this change should induce speedups in every city's Admin page.

Before/After screenshots (if applicable)
Testing instructions
  1. Load the admin page and verify that everything looks good! Additionally, you can time the amount of time it takes
Things to check before submitting the PR
srihariKrishnaswamy commented 3 weeks ago
  1. It would be helpful to include the speedups that you're seeing in your dev environment (along w/ which city's db you have) using your approach! I tested twice with develop and twice with your branch, and saw the initial page load go from ~40s -> ~30s, with the full time to load all the data remaining about the same.
  2. You may even want to frame the entire PR in terms of what it does rather than how you did it! I imagine that the PR title could be about speeding up initial page load for Admin page to prevent proxy error. Then you describe how you did it in the PR description!
  3. It looks like you forgot to commit your change to the routes.conf file! I added the line somewhere random in my dev env quick so that I could test, but you should add your change!

I'm ultimately happy with this, it seems like it'll probably improve the initial page load time by ~10 seconds, which might be enough for me to be able to load the Seattle Admin page for now 😅

Gotcha yeah I just updated the PR description & title. Sorry about that, I totally did forget to commit it! Because I was printing out the time differences and stuff I had diffs in a lot of files so that one just slipped through the cracks when I was adding files.

srihariKrishnaswamy commented 3 weeks ago

Alright pushed changes that addressed everything!

srihariKrishnaswamy commented 3 weeks ago

Alright, got the last commit up!