Skip to content

refactor(address-search): unify modal state into discriminated union#44

Open
divazbozz wants to merge 2 commits intomainfrom
claude/hardcore-gould-38e718
Open

refactor(address-search): unify modal state into discriminated union#44
divazbozz wants to merge 2 commits intomainfrom
claude/hardcore-gould-38e718

Conversation

@divazbozz
Copy link
Copy Markdown
Contributor

@divazbozz divazbozz commented Apr 20, 2026

Summary

  • Replace three independent modal useStates (multipleUtilityResult, multipleAddressResults, energySplashRedirectUrl) in AddressSearchApp.tsx with a single ModalState discriminated union.
  • handleSelect branches now each issue one setModalState(...) call — no more manual clears of sibling modal states.
  • handleBack resets to { kind: "idle" } (preserves prior semantics: also clears selection / externalAddressId).
  • addressConfirmData stays separate — it's a confirmation concern, not a routing one.

Test plan

  • npx tsc --noEmit clean
  • npm run lint clean
  • npm run build succeeds
  • Manual: verify multiple-utility modal renders, multiple-address modal renders, energy-only splash renders, and Back resets to idle
  • Manual: verify confirm modal still works independently and doesn't interact with routing modal state

🤖 Generated with Claude Code


Open in Devin Review

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>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 20, 2026

Important

Review skipped

Auto reviews are disabled on this repository. To trigger a review, include rabbit in the PR description. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: c3c43fa9-dce2-49ed-866a-8fde5cf72d00

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/hardcore-gould-38e718

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

devin-ai-integration[bot]

This comment was marked as resolved.

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant