Repository navigation
Conversation
Converts the `priceDisplay` function to an IIFE-computed const so the quote-price range string is derived exactly once per render rather than being called twice — once for the truthiness guard and again to read the value in the JSX.
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
This branch had an error being deployed
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.
Daily Product Improvement — 2026-08-27
📝 TLDR
Convert
priceDisplayfrom a called-twice function to a once-computed const inVendorCard.📝 Description
During a codebase review, the daily improvement agent identified that
VendorCardwas callingpriceDisplay()twice on every render — once as a truthiness guard and again to read the value inside the JSX. The function iterates over quote prices (min/max calculation,formatCurrencycalls) both times, doing redundant work.The fix converts the inline function to an IIFE-evaluated
constso the result is computed exactly once and referenced twice.This Change
priceDisplayis nowconst priceDisplay = (() => { … })()— an immediately-invoked function expression evaluated once at render time.{priceDisplay && <span>…{priceDisplay}</span>}.Recommendations Reviewed
The agent reviewed the following improvement candidates (all confirmed not covered by an existing open PR):
VendorCardpriceDisplay()called twice per render (selected)events-page-client<Loader2>spinnerGuestSearchFilterhandleChangeOptioncallssetSelectedRsvpFilterredundantly before delegating tofilterHouseholdsByInvitationwhich calls it againGuestsViewDrawerDraftinitial-state object defined inlineWhy This Was Selected
The
VendorCarddouble-call is the highest signal-to-noise fix: it is a clear correctness/efficiency issue with no ambiguity, touches a single self-contained expression, carries zero risk of regression, and leaves the component measurably cleaner. The other candidates are valid but either more debatable (spinner style is subjective) or require reading more state-management context to verify safely.Future Recommendations
<p>Loading events…</p>inevents-page-client.tsxwith a<Loader2 className="animate-spin" />spinner consistent with other loading states in the app.GuestSearchFilterredundant state set (Small): InhandleChangeOption, remove the directsetSelectedRsvpFilter(option)call that precedes thefilterHouseholdsByInvitation(option)call, since the latter already sets the same state.GuestsViewduplicate DrawerDraft object (Small): Extract the repeatedDrawerDraftinitial-state literal into a namedconstto avoid duplication.event-card.tsxhides the time if onlystartTimeis set andendTimeis missing. ShowstartTimealone whenendTimeis absent (verify against PR fix(events): show start time even when no end time is set #260 which may address this).🧪 Testing
🧪 How to test as a user
$1,000 – $2,500) appears correctly on the vendor card.🎨 Style and code quality
baseUrldeprecation warning, unrelated to this change).📦 Dependencies
📝 Files Changed
src/components/vendor/vendor-card.tsx— convertpriceDisplayfunction to IIFE const; update JSX references frompriceDisplay()topriceDisplay.Generated by Claude Code