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

Lazily load parking lot data only when the city is used #88

Closed
Eric-Arellano opened this issue Apr 9, 2023 · 2 comments
Closed

Lazily load parking lot data only when the city is used #88

Eric-Arellano opened this issue Apr 9, 2023 · 2 comments

Comments

@Eric-Arellano
Copy link
Contributor

Eric-Arellano commented Apr 9, 2023

As of #109, the parking lots JSON file is now 3.3 MB when built with Parcel. That's pretty big for users with slow Internet and mobile.

We can improve this by instead only loading the data for each city when it's relevant. We'll use something like Parcel's glob mechanism (https://parceljs.org/features/dependency-resolution/#glob-specifiers) and JavaScript's dynamic await imports to only load the city when it's in view.

There are two cases for that:

  1. The city is explicitly selected via the URL or city toggle, which calls this function:

const setMapToCity = (map, cityId, cityProperties) => {

  1. The user drags the map to a new city. The mechanism to detect this closely relates to Dragging map to city should pull up its scorecard #112.
@Eric-Arellano Eric-Arellano self-assigned this Aug 10, 2023
@Eric-Arellano Eric-Arellano changed the title Consider lazily loading parking lot data only when the city is used Lazily load parking lot data only when the city is used Aug 10, 2023
@Eric-Arellano Eric-Arellano removed their assignment Aug 16, 2023
@tunglinn
Copy link
Collaborator

tunglinn commented Nov 17, 2023

Create feature branch:
First PR:

  • write script to split geojson
  • get map to load new split geojson
  • update scripts and test

parcel-bundler/parcel#7584

@tunglinn
Copy link
Collaborator

tunglinn commented Feb 5, 2024

Implemented via #142

@tunglinn tunglinn closed this as completed Feb 5, 2024
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

2 participants