refactor(address-search): unify modal state into discriminated union#44
refactor(address-search): unify modal state into discriminated union#44
Conversation
Replace three independent modal useStates (multipleUtilityResult, multipleAddressResults, energySplashRedirectUrl) with a single ModalState discriminated union. Eliminates the "forgot to clear" bug class where switching modal variants required manually resetting the others. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Important Review skippedAuto reviews are disabled on this repository. To trigger a review, include ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Prevents a stale in-flight hydration that resolves after handleBack from re-opening the modal with an empty address (and, in the energy-splash case, stranding the user on a splash that can't redirect because handleRedirect early-returns on falsy selection). Caught in review by devin-ai-integration. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Summary
multipleUtilityResult,multipleAddressResults,energySplashRedirectUrl) in AddressSearchApp.tsx with a singleModalStatediscriminated union.handleSelectbranches now each issue onesetModalState(...)call — no more manual clears of sibling modal states.handleBackresets to{ kind: "idle" }(preserves prior semantics: also clearsselection/externalAddressId).addressConfirmDatastays separate — it's a confirmation concern, not a routing one.Test plan
npx tsc --noEmitcleannpm run lintcleannpm run buildsucceeds🤖 Generated with Claude Code