refactor: service card and opening times optimisation#250
Merged
james-cross merged 1 commit intostagingfrom Feb 18, 2026
Merged
refactor: service card and opening times optimisation#250james-cross merged 1 commit intostagingfrom
james-cross merged 1 commit intostagingfrom
Conversation
- Extract OpeningTimesList component and formatOpeningTimes utility from duplicated IIFEs in ServiceCard and OrganisationServicesAccordion - Extract VerifiedBadge component from duplicated SVG in ServiceCard and GroupedServiceCard - Extract buildOrganisationUrl utility from duplicated URL construction logic - Simplify opening times cache key to avoid batch invalidation of all entries - Split ServiceCard useMemo into service-specific and URL-specific memos - Move appointment-only keyword detection to processServiceData (runs once per service) - Pre-decode text in processServiceData to avoid per-render decoding - Skip LazyMarkdownContent for plain text descriptions
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.
Summary
Extracts shared components and utilities from duplicated code across ServiceCard, GroupedServiceCard, and OrganisationServicesAccordion. Moves per-render work to data processing time where possible.
Part of the services API and rendering optimisation series (chunks 02-04).
Changes
OpeningTimesListcomponent andformatOpeningTimesutility from duplicated opening times IIFEs in ServiceCard and OrganisationServicesAccordionVerifiedBadgecomponent from duplicated inline SVG in ServiceCard and GroupedServiceCardbuildOrganisationUrlutility from duplicated URL construction in both card componentsuseMemointo service-specific ([service]) and URL-specific ([slug, location, searchParams]) memosisServiceOpenNow(per-render) toprocessServiceData(once per service)decodeText) inprocessServiceDatainstead of per-render in cardsLazyMarkdownContentfor plain text descriptions (render<p>instead)$facetpipeline (previous commit)Testing
OpeningTimesList,VerifiedBadge) covered by existing ServiceCard and accordion tests