Repository navigation
Stop bundling the places and competitions data into the /map client scripts - #333
Merged
Merged
Conversation
Contributor
|
@propcgamer20-png is attempting to deploy a commit to the studentsuite Team on Vercel. A member of the Team first needs to authorize it. |
1 of 5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this changes
Fixes #293.
/mapno longer loads the script chunk that held the wholestudymap.config(all places and all competitions). Client code stops importing the config; the server page reads it and passescities,centeranddefaultZoomdown as props, as the issue proposed.src/lib/places-utils.ts(new):filterPlaces,getCities,cityBoundsandBounds, with no config import.getCitiestakespreferredOrderfrom its caller (default[]).src/lib/places.ts: keepsgetPlaces()and agetCitieswrapper that defaults to the config order, and re-exports the helpers, so every server importer andplaces.test.tsare unchanged.src/app/map/page.tsx,src/app/embed/page.tsx: readcities,center,defaultZoomfrom the config and pass them as props.PlacesMap,EmbedMap,MapView: takecenter/defaultZoom(MapView's are now required) instead of reading the config.SuggestPlaceDialog,UserPlaceDialog: takedatasetCitiesas a prop instead of computinggetCities(getPlaces())at module scope.city-stats-card.tsximports fromplaces-utils.Proof
Same machine,
npm run buildonmainand on this branch, summing the distinct/_next/static/chunks/*.jsfiles referenced by.next/server/app/map.html:/maplhr-airport-01andbroadcom-masters)/mapHTMLThe HTML grows by 7,961 bytes because the page now serialises
cities,centeranddefaultZoomas props.lhr-airport-01appears once in the built/mapHTML (the server props), as before; the issue's separate point about serving places from a JSON route is untouched.grep -l lhr-airport-01 .next/static/chunks/*.jsstill lists one chunk on this branch. It is not referenced bymap.html; as far as I could tell from the source it is the lazily loaded site-search dialog (site-search.tsximportsgetPlacesandgetCompetitions), which loads when someone opens search. I did not change that.npm run typecheck,npm run lint,prettier --check src: clean.npm run test:unit: 647 passed.Not verified
I did not load
/mapin a browser on this branch, so the acceptance items "all 1,950 pins render" and "filters, search, share and near-me work" are covered by the existing component tests only.Type of change