Skip to content

Cap the map results list at one page and mount a single MapPanel - #323

Merged
AnayDhawan merged 1 commit into
StudentSuite:mainfrom
propcgamer20-png:perf/results-list-cap
Oct 30, 2026
Merged

AnayDhawan merged 1 commit into
StudentSuite:mainfrom
propcgamer20-png:perf/results-list-cap

Conversation

@propcgamer20-png

Copy link
Copy Markdown
Member

What this changes

Fixes #294. The unfiltered map built a list row (a select button and two external links) for every place, and always mounted the desktop MapPanel even on a phone, where CSS hid it.

  • src/components/map/results-list.tsx: renders 100 rows (RESULTS_PAGE_SIZE, overridable with a pageSize prop) and a "Show 100 more (N not shown)" button for the rest, the pattern the nearest-first list already uses. A new result set (filter, search, nearest-first) starts again from the first page. If the focused pin is beyond the loaded rows, its row is added so the highlight still shows. No new dependency.
  • src/lib/use-media-query.ts (new): useMediaQuery(query) on useSyncExternalStore; false on the server and during hydration, so there is no hydration mismatch.
  • src/components/map/places-map.tsx: the sidebar MapPanel mounts only at min-width: 1024px (the same breakpoint as the existing lg: classes), the sheet's panel only below it.
  • Tests: 5 new cases in results-list.test.tsx (first page plus button, next pages, no button when it fits, focused row beyond the page, reset on a new result set) and 2 in places-map.test.tsx (panel mounts on desktop, not on a phone). The existing places-map tests now stub a desktop matchMedia, since jsdom has none.

Proof

Measured in Chrome against npm run dev at /map, with the issue's selectors:

desktop (1280px)  rows in the panel: 100 + the button   "Directions to" links: 100   MapPanels: 1
                  after "Show more": 200 rows
mobile (390px)    rows in the panel: 0                  "Directions to" links: 0     MapPanels: 0 until the sheet is opened

The desktop page still reports two Search places by name or city inputs: one is the sidebar panel and the other is the separate mobile top bar, which CSS hides at that width (it is not a MapPanel). I did not open the mobile sheet in the browser; the unit tests cover that the sheet panel is the one mounted below lg.

npm run lint, npm run typecheck, npm run format:check clean; npm run test:unit: 608 passed.

Type of change

  • Code or fix
  • New public place(s)
  • New or updated benefit guide
  • New or updated resource link
  • Docs

@vercel

vercel Bot commented Oct 29, 2026

Copy link
Copy Markdown
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.

@AnayDhawan
AnayDhawan merged commit 3219206 into StudentSuite:main Oct 30, 2026
4 of 5 checks passed
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

Successfully merging this pull request may close these issues.

Results list renders all 1,950 rows; desktop panel mounts on mobile

2 participants