Skip to content

perf(event): resolve each event's display once per surface - #508

Merged
Ardnived merged 5 commits into
mainfrom
perf/card-display-once
Nov 26, 2026
Merged

Ardnived merged 5 commits into
mainfrom
perf/card-display-once

Conversation

@Ardnived

@Ardnived Ardnived commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • A class card, the class page and the registration and share views now each work out an event's display once. Before, every component on them did it again for itself.
  • No visible change. A 400-row results list makes up to about 400 resolver runs instead of about 800, and the class page makes one instead of five.

Change outline

Components — who resolves

EventFacts, EventChips, EventRegisterBar and EventActions used to call useEventDisplay themselves. Now the view resolves once, and each component only renders the strings it is handed.

 EventListItem / RegistrationView / ShareView
+  strings = useEventDisplay(event)                     # once per surface
 EventView
   strings = useEventDisplay(event)                     # already here, for the sticky footer
+  → EventDetails, EventRegisterBar, EventActions       # and the pinned Register
   EventFacts
-    event → useEventDisplay(event)
+    strings
   EventChips
-    event → useEventDisplay(event); event.languages
+    strings, languages
   EventRegisterBar / EventActions
-    useEventDisplay(event)
+    strings                                            # on EventSurfaceProps
 EventPinCard (Map.tsx)                                 # unchanged: already one call

Files — stories and specs

Each story or spec resolves its sample in its own small component, the way a view does.

+src/test-support/count-resolves.ts    # counts resolves while a spec renders
+EventListItem.resolve.test.tsx       # a card resolves once
+EventDetails.resolve.test.tsx        # the whole class page resolves once
 EventFacts / EventChips / EventDetails / EventActions stories and specs   # resolve locally

Preview

No visible change. Preview pending:

  • App preview: the search cards and a class page match main.
  • Component library: the Event Facts, Event Chips, Event Actions and Event Details stories match main.

Test results

  • Lean gate: ✓ lint, typecheck, unit
  • Targeted specs:
    • EventListItem.resolve.test.tsx fails on main with expected 2 to be 1.
    • EventDetails.resolve.test.tsx renders chips, facts, Register and the actions for real. It fails with expected 2 to be 1 once EventActions calls the hook again.
  • Build: N/A (CI)

Notes for reviewer

  • How resolves are counted: count-resolves.ts counts the Intl.ListFormat each resolve of a recurring class builds, and its docblock states that assumption once. Spying on the hook through vi.mock(importOriginal) loaded a second React (useMemo of null). Spying on resolveEventDisplay through @/lib/shape hit a circular import from the mocks.
  • strings is on EventSurfaceProps, beside event and basePath, so EventDetails, EventRegisterBar and EventActions can't take one without the others.
  • src/mocks/ stays sample data only. A shared FactsFor/ChipsFor helper lived there briefly. It is gone, so stories and specs follow the one pattern the views do.

Closes #505

🤖 Generated with Claude Code

EventFacts and EventChips each called useEventDisplay, and each call kept its
own memo, so every card ran the resolver, its date formatting and an
Intl.ListFormat twice: up to about 800 runs for a 400-row reveal. Both now
take the strings their parent resolved (`strings`, plus `languages` for the
chips). EventListItem, EventDetails, RegistrationView and ShareView call the
hook once each.

A new spec renders a card and the class page body for real and counts
resolves through the ListFormat each one builds. It fails on main with 2.

Closes #505

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@sydevs-dispatcher

sydevs-dispatcher Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

🤖 no session running

recent dispatches
  • 12:51Z review-pr · attempt 3 · session · done
  • 12:51Z review-pr · attempt 3 · session
  • 03:21Z review-pr · attempt 2 · session · timed out
  • 03:21Z review-pr · attempt 2 · session
  • 20:49Z review-pr · attempt 1 · session · timed out

Written by the sydevs dispatcher. Sessions never edit this comment.

@sydevs-dispatcher sydevs-dispatcher Bot added the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Nov 26, 2026
@sydevs-dispatcher sydevs-dispatcher Bot moved this from Pending to Working in SYDevelopers Technical Roadmap Nov 26, 2026
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
sahajatlas-design bb68d8a Nov 26 2026, 09:24 PM

…urface

From the adversarial review of #508:
- FactsFor and ChipsFor (src/mocks/event-surfaces.tsx) replace the wrapper
  copied into three files and the two near-copies; none shadows the real
  component's name any more.
- The resolve count moves to src/test-support/count-resolves.ts, with the
  ListFormat assumption it rests on stated once.
- The class page case moves beside EventDetails and says what it pins: its
  chips and facts share one resolve. The register bar and the actions still
  resolve for themselves, and the spec stubs them.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@sydevs-dispatcher sydevs-dispatcher Bot removed the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Nov 26, 2026
@sydevs-dispatcher sydevs-dispatcher Bot added bot:working Lock: a cloud session is running on this item. Removed when it ends. and removed bot:working Lock: a cloud session is running on this item. Removed when it ends. labels Nov 26, 2026
@sydevs-dispatcher

Copy link
Copy Markdown
Contributor

The session for review-pr did not finish after 3 attempts. I have stopped retrying. A mention (@sydevs-bot) or a push from you starts me again.

🤖 sydevs dispatcher

@sydevs-dispatcher sydevs-dispatcher Bot moved this from Working to Awaiting in SYDevelopers Technical Roadmap Nov 26, 2026
@sydevs-dispatcher sydevs-dispatcher Bot added the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Nov 26, 2026
@sydevs-dispatcher sydevs-dispatcher Bot moved this from Awaiting to Working in SYDevelopers Technical Roadmap Nov 26, 2026
Ardnived and others added 2 commits November 26, 2026 13:55
EventView already resolved the event's display for its sticky-footer
check, and then EventDetails, EventRegisterBar and EventActions each
resolved it again. The view's one resolve now reaches all three through
`strings` on EventSurfaceProps, so the page resolves once wherever the
calls to action render. RegistrationView hands its own resolve to the
register bar the same way.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
`src/mocks/` holds sample data, and FactsFor and ChipsFor were the only
components in it. Each story and spec now resolves its sample's strings
in its own small component, as the EventDetails and EventActions stories
do, so every caller follows one pattern.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@Ardnived Ardnived changed the title perf(list): resolve each class card's display once, not twice perf(event): resolve each event's display once per surface Nov 26, 2026
# Conflicts:
#	src/components/molecules/EventActions/EventActions.stories.tsx
#	src/components/molecules/EventActions/EventActions.tsx
#	src/components/organisms/EventDetails/EventDetails.badge.test.tsx
#	src/components/organisms/EventDetails/EventDetails.cta.test.tsx
#	src/components/organisms/EventDetails/EventDetails.stories.tsx
#	src/components/organisms/EventDetails/EventDetails.tsx
#	src/views/EventView/EventView.tsx
@Ardnived
Ardnived merged commit ec4af1f into main Nov 26, 2026
15 checks passed
@Ardnived
Ardnived deleted the perf/card-display-once branch November 26, 2026 21:27
@sydevs-dispatcher sydevs-dispatcher Bot moved this from Working to Done in SYDevelopers Technical Roadmap Nov 26, 2026
Ardnived added a commit that referenced this pull request Nov 26, 2026
…sign-up confirmation (#518)

* feat(share): one share block and one class summary for Share and the sign-up confirmation

- ShareContent is the one share block: Share opens the device's own share
  sheet; where there is none, or a host page refuses it, the same button
  opens the region's networks in a popover, in their brand colours, and the
  popover closes after a pick. Backing out of the sheet keeps the button.
  Copy link is a named button that says "Link copied" for 2.5 s, announced,
  and on a refused clipboard selects the link and says how to copy it by hand.
- EventSummary (new molecule) is the list card's body: title with its Online
  tag, card facts, chips. The list card renders it in its link; Share,
  Register and the confirmation box it at their top (hideSubtext on the last
  two). EventFacts loses its boxed `summary` surface and gains hideSubtext.
- The Share panel opens on the summary under "Share this class"
  (share.title_class); share.title goes on the retiring list.
- The poster QR code row moves from Share to the bottom of the class page.
- The snapshot gains the four new share keys, copied by hand from
  production while a full sync is blocked on #466; share.copy_link is wired
  again (SahajCloud#1288 re-declares it).

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* docs(share): what Share and Copy link do under a refusing policy

The Permissions Policy rows now say what each refusal does: Share opens a
popover of networks, and Copy link selects the link to copy by hand.
DESIGN_SYSTEM rows for EventSummary, ShareContent and the moved QrPoster,
and a CHANGELOG entry.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* test(i18n): share.title retires through SahajCloud#1290

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* refactor(share): EventSummary takes its parent's resolved display

After #508 a parent resolves an event's display once and hands the strings
to its facts and chips. EventSummary follows suit, so the list card, Share
and Register each still resolve once.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* refactor: simplify per /simplify pass

- CopyField moves into EventActions, its one caller, so a class page no
  longer loads react-share and the share block to copy a phone number; the
  multi-export exception for ShareContent goes with it.
- The share targets' common button props are built once in PlatformButton.
- EventSummary reads the resolved `display.online`; ShareButton reuses
  ShareContentProps; Copy link resolves its status string once.
- An open fallback popover now closes from the Share button (review finding),
  with a spec.
- Stale comments and a spec that could not fail are gone; the changelog
  notes the list card's Online tag.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* docs(changelog): link the share entry to #518

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(copy): one select-on-refusal path, in useCopy

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(actions): inline the single-use phone CopyField

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
@sydevs-dispatcher sydevs-dispatcher Bot added bot:working Lock: a cloud session is running on this item. Removed when it ends. and removed bot:working Lock: a cloud session is running on this item. Removed when it ends. labels Nov 27, 2026
@sydevs-dispatcher sydevs-dispatcher Bot added the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Nov 27, 2026
@Ardnived Ardnived removed the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Nov 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

perf(list): resolve each class card's display once, not twice

1 participant