Skip to content

A place page's search field jumps down when the page finishes loading #494

Backlog

Description

@Ardnived

Summary

When a visitor opens a country, region or city page directly (a cold deep link), the loading screen never shows the place's subtitle, and shows its title only once the region tree is cached — on a truly cold load it has neither. When the page arrives, the title and subtitle appear and pushes the search field band and everything under it down by about 16–26px. The loading chrome exists so nothing moves on arrival (#485), and these are the pieces it still leaves out.

Approach

  • DrawerChrome (src/views/fallbacks.tsx) already reads the region tree from the cache (regionsQuery, enabled: false) to name the place. RegionNodeSchema (src/types/region.ts:28) carries subtitle, so a city's own subtitle can come from that same node, passed as NavHeader's subtitle.
  • RegionView's subtitle (src/views/RegionView/RegionView.tsx:117) is the city's own subtitle, or else "All classes are free" (common.chrome.all_classes_free) whenever events are listed. The tree node does not say whether events are listed. Settle from the code which of these holds before you build:
    • the tree carries enough (an event count or similar) to decide it;
    • a reserved, empty subtitle line keeps the height without promising text the page may not show;
    • the fallback line is left out, and the shift remains only for places with no subtitle of their own.
  • Keep the chrome's rule: cache-only reads, nothing that can throw or suspend.

Acceptance criteria

  • On a deep link to a city with its own subtitle, once the region tree is cached, the subtitle shows while the page loads and the field band does not move when it arrives.
  • On a cold deep link to a place without one, the band does not move when the page arrives, or this ticket's notes record why a shift remains and how large it is.
  • Decide, and record in this ticket, whether a truly cold load (no region tree cached) reserves the title and subtitle lines too.
  • Loading and error screens never render text the loaded page would not show.

Verification checklist

  • pnpm test:run src/views/fallbacks.test.tsx covers a region whose cached node has a subtitle, and the spec was watched failing without the change.
  • Ladle, Views › Region, Example "City": switch the Fallback control between None and Loading; the field band's top edge is at the same y in both.
  • pnpm dev, 390×844, /gb/south-east/london with region requests throttled (Slow 3G): measure the search field's top before and after the view arrives; it is unchanged, within 1px.

Notes

Found during #485, which put the field band on the loading and error screens. Measured there in Ladle and on the dev server: the band sits ~16px higher in the loading chrome than in the loaded City story.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Fields

    Priority

    Low

    Hold Until

    None yet

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions