fix: Homepage product navigation#4949
Conversation
|
@control_center_review_bot please review this pr |
|
@XyneSpaces please review this pr |
XyneSpaces
left a comment
There was a problem hiding this comment.
Automated Review Summary
PR: fix: Homepage product navigation
Reviewer: XyneSpaces Automation
Findings
Found 1 issue requiring attention:
The catch block in all three modal bodies (SwitchMerchantBody, SelectMerchantBody, CreateNewMerchantBody) only shows a toast on failure but doesn't prevent the subsequent navigation logic from executing. If internalSwitch fails, the code still calls setActiveProductValue and RescriptReactRouter.replace, potentially navigating to a product page that hasn't actually been switched to.
Fix: Move the navigation logic (setActiveProductValue and replace) inside the try block, after the internalSwitch call succeeds, or add an early return in the catch block.
Verdict: Address the error handling issue before merge.
| let _ = await internalSwitch(~expectedMerchantId=Some(merchantDetails.id), ~version) | ||
| setActiveProductValue(selectedProduct) | ||
| let productUrl = ProductUtils.getProductUrl(~productType=selectedProduct, ~isLiveMode) | ||
| RescriptReactRouter.replace(productUrl) |
There was a problem hiding this comment.
internalSwitch fails. Move setActiveProductValue and RescriptReactRouter.replace inside the try block after internalSwitch succeeds, or add early return in catch.
Type of Change
Description
Fixes broken navigation from the homepage ("Explore composable services" cards). Clicking a product's Learn More button now consistently opens the merchant-switch modal, switches into the selected product, and lands the user on that product's home page.
Changes:
setActiveProductValue(selectedProduct)
let productUrl = ProductUtils.getProductUrl(~productType=selectedProduct, ~isLiveMode)
RescriptReactRouter.replace(productUrl)
Same product switch
Screen.Recording.2026-06-09.at.3.53.24.PM.mov
Switch between products
Screen.Recording.2026-06-09.at.3.54.22.PM.mov
Switch when single merchant present for a product
Screen.Recording.2026-06-09.at.3.55.03.PM.mov
Motivation and Context
Selecting a product from the homepage was either bouncing back to /v2/home or behaving differently per product. Two root causes:
Resolves #3460.
How did you test it?
Where to test it?
Backend Dependency
Backend PR URL:
Feature Flag
Feature flag name(s):
Checklist
npm run re:build