Repository navigation
Description
Summary
The /search distance-ranked results list is hard-capped at the 50 nearest
matches (NEAREST_LIMIT, src/config/api/fetch.ts:49) with no affordance to go
past it — a visitor searching a dense metro simply cannot reach match #51, and
nothing on screen says the list was truncated. The competing WordPress product
(The Events Calendar) paginates the full set. Add an explicit "Load more"
control that reveals the rest of the matching events in pages, and fix the
ordering bug the cap causes along the way (see Current behavior, point 3).
Only the /search list is affected. Region/area lists
(fetch.ts:400-402) and the CalendarView (getCalendarEvents,
fetch.ts:456-472) are already uncapped.
Current behavior
-
The cap is a render budget, not a network budget — so there is no
server-side pagination to design.getEvents(fetch.ts:433-448) issues no
per-search request at all: it reads the whole published-event feed once from
the shared['geojson']React Query cache (loadGeojson,fetch.ts:181-187;
fetchedpagination: falseatfetch.ts:171), filters it through the shared
matchesFilterspredicate (filteredFeed,fetch.ts:410-429), sorts by
@turfdistance, and truncates with.slice(0, NEAREST_LIMIT)
(fetch.ts:447). Every match past feat(search): filter events by a date range #50 is already in memory on the client.
getCalendarEventsis the in-repo precedent for reading the same
filteredFeeduncapped. -
The map is already uncapped, so revealing more rows adds no pins.
Map.tsx:224-233filters the whole feed with the samematchesFilters
predicate and no slice. The list/map divergence this creates is documented at
fetch.ts:441-443; "Load more" narrows it rather than widening it. (The map
also ignores the "< 500 km" cut — a separate, pre-existing divergence, out of
scope here.) -
The cap silently truncates the sort.
sortEvents
(DynamicEventsList.tsx:63-75) runs on the already-capped 50, so
?sort=soonesttoday means "soonest among the 50 nearest", not "soonest of
the matches", andrecommended's scoring (calculateOrder, :44-55) re-ranks
a pre-truncated pool. Correct order of operations is filter → sort → slice
to page. -
The "< 500 km" pill is derived from the fetched list.
hasFar
(DynamicEventsList.tsx:105-110) issorted.some(e => e.distance > 500).
With today's nearest-50 pool it fires only when the near results actually run
out; against the full feed it would be true for essentially every?center
search (the global feed always holds something >500 km away), turning an
occasional pill into a permanent one. See Open decisions, C.
Proposed improvement
- Move the slice out of the fetcher and into the view.
getEventsreturns the
full distance-sorted matching set (dropNEAREST_LIMIT,fetch.ts:49/:447);
DynamicEventsListsorts (:100), applies the distance cut (:108-110), then
slices to the revealed page count. - Render a "Load more" button at the foot of the list in
DynamicEventsList
(the data-connected container), not inEventsList—EventsListis
deliberately kept free of the data/i18n graph so a story can render it without
a query client (EventsList.tsx:9-11). - Hide the button when nothing is left to reveal, and when the list is empty (the
EmptyResults/CountrySiteOfferbranch atDynamicEventsList.tsx:117-121
is untouched). - Persist the revealed count in the URL — see Open decisions, B.
- Announce the reveal and manage focus — see Acceptance criteria.
Explicit button, not infinite scroll. The drawer body is the scroll container
(Drawer.tsx:38, overflow-y-auto) and vaul also drives it for drag-to-dismiss;
a button keeps the reveal off that scroll handler and is predictable for keyboard
and screen-reader users.
Open decisions
| # | Decision | Recommendation |
|---|---|---|
| A | Page size, and whether the first page stays 50 | 25/page. The first screen gets lighter than today, and "load more" is cheap because nothing refetches. |
| B | Revealed count in the URL, or component state? | URL (e.g. ?shown= or ?page=), following the ?all=1 precedent for the exact reason documented at SearchView.tsx:48-50: the drawer stack remounts views on navigation, so component state would silently reset the reveal every time the user opens an event and comes back. Write it with replace: true like showAllEvents (SearchView.tsx:52-62) so paging doesn't stack history entries. |
| C | What happens to the "< 500 km" pill once the pool is uncapped (point 4 above) | Keep the cut as a predicate ahead of the page slice and accept that the pill becomes near-permanent for ?center searches — it is then an honest statement that the list is distance-limited. Worth a design confirmation before implementing, since it is a visible change on every search. |
| D | Does the far-events reveal (?all=1) reset the page count, or stack with it? |
Reset — dismissing the distance cap changes the result set, so the page count should start over, same as a filter change. |
Acceptance criteria
- With more matches than one page, a "Load more" control renders below the
last card inDynamicEventsList; pressing it reveals the next page in
place, with no network request (verify: no newevents/geojsonentry in
the network panel, React Query devtools show no refetch). - The control is absent when the revealed count covers all matches, and
absent for an empty result set. - Sorting is applied to the full matching set before the page slice:
switching?sort=sooneston a search with >1 page surfaces events that
today's nearest-50 pool excludes. Switching sort still never refetches
(use-sort.ts:15-31; sort stays out of the query key). - The reveal count stays out of
eventsQuery's key
(src/config/api/index.ts:37-51) — it is presentation, like sort. A count
in the key would refetch per press and would make the SearchView story's
cache seed miss (SearchView.stories.tsx:55-60). - The count resets to one page when the result set changes: a new geocoded
search, any filter change, and dismissing the "< 500 km" pill. Note
preserveSearchState(views/shared.tsx:224-229) re-encodes from an
empty base, so a new search drops the param for free — butuseSetFilters
(hooks/use-filters.ts:28-49) anduseSetSortOrder(use-sort.ts:26-31)
copyprevwholesale, so a filter edit needs an explicit reset. - Deep-linking a URL with the reveal param restores that many results, and
returning from an event detail (a drawer-stack remount) preserves it. - Focus is not lost on reveal: focus stays on the button while it remains
mounted, and moves to the first newly revealed row when the final press
unmounts it. - The number newly revealed (or the new total) is announced politely —
role="status"/aria-live="polite", per the precedents at
GeolocationPrompt.tsx:35andShareContent.tsx:50. - Pins are unchanged by a reveal (
Map.tsx:224-233already renders every
matching feature); revealed rows keep the hover→pin highlight and
hover-prefetch behaviour for free (EventListItem.tsx:40-48, 80-88). - New label(s) added across all 10 locales
(cs, de, en, es, fr, hu, nl, pt-BR, ru, uk) via
pnpm i18n:add— shortcommon.jsonUI labels have repeatedly shipped
en-only in this repo. If the label interpolates a number, do not name the
variablecount— that triggers i18next pluralization and resolves
key_one/key_otherinstead of the base key (see
.claude/rules/i18n-and-state.md). - Unit coverage in the node-only lane: the sort→cut→slice pipeline extracted
as a pure helper and tested directly, plus arenderToStaticMarkup
assertion that the control appears/disappears at the boundary. - A Ladle case in
SearchView.stories.tsxseeded with more than one page of
events. - Lint + typecheck +
pnpm test:run+ build +ladle:buildpass. - Verified in the running widget against a dense search centre (e.g. a
European capital) where the match count exceeds 50.
Non-goals
- Server-side pagination — impossible to justify here: the whole feed is fetched
once and cached (fetch.ts:165-187), so there is nothing to page over the wire. - Region / area / venue lists and the CalendarView — already uncapped.
- The list-vs-map divergence over the "< 500 km" cut (map shows far pins while the
list hides far rows) — pre-existing, separate ticket if it matters.
Files affected
src/config/api/fetch.ts—NEAREST_LIMIT(:49),getEvents(:433-448)src/components/organisms/EventsList/DynamicEventsList.tsx— sort/cut/slice
pipeline (:63-75, :99-110), the control, the live regionsrc/views/SearchView/SearchView.tsx— the reveal param, beside?all=1
(:51-62, :82-88)src/lib/shape/— the reveal param's codec, if it gets one (besidesort.ts)src/hooks/use-filters.ts,src/hooks/use-sort.ts— reset on changepublic/locales/*/common.json— the new label(s)src/views/SearchView/SearchView.stories.tsx— the >1-page case
References
NEAREST_LIMITintroduced inc6cbf4a(data-layer repoint to SahajCloud); the
"< 500 km" distance cap in feat(search): event filters — drawer, shared predicate, pills, distance cap #39, its dismissable pill in fix: UI bug sweep — colour system, time filter, event & registration surfaces, i18n & nav #74.?sort=and the list toolbar: feat(list): move filters to a list toolbar with a sort selector #75 / PR feat(list): move filters to a list toolbar with a sort selector #77.?all=1— the URL-persisted reveal precedent this should follow..claude/rules/data-layer.md(caching / query-key contract),
.claude/rules/i18n-and-state.md(URL-derived slices, thecounttrap).
Metadata
Metadata
Assignees
Labels
Type
Fields
Hold Until
Activity
feat(search): tighten the nearby boundary, half of it across a border
feat(search): auto-page the nearby results, and restyle the control
refactor(search): move Filters and Sort into the drawer header
docs(search): story the new reveal states, record the boundary rules