feat(widget): apply per-tab navigation config #781
Conversation
|
E2E Examples — all passedAll examples passed in the latest run. |
E2E Playground resultsDetails
📥 Download full HTML report (open the run → Artifacts → |
53fa01e to
9f97fb1
Compare
572513c to
a80d82f
Compare
9c39a0a to
6ae7bef
Compare
a80d82f to
65f2d16
Compare
5b24746 to
dc8bbac
Compare
✅ E2E Dev Smoke — passing
4 passed · 0 failed · 0 skipped · 22s |
🔍 QA Review — EMB-465PR: #781 feat(widget): add per-tab navigation config Re-review summaryThe developer responded to all 3 items from the first review (2 formal change requests + 1 advisory). All items are now resolved or accepted with justification. The original Issue 1 (Medium) was a false positive — the form-clearing code path was in Acceptance criteria check
Resolution of previously flagged items
Test coverageExisting coverage confirmed:
Remaining gap (not blocking): No integration test for the Downstream impactSplit-tab regression risk: Low — Breaking change for |
There was a problem hiding this comment.
Requesting changes on 2 items — each requires either a code fix or an explicit acceptance comment with justification before this review is considered complete.
| # | Severity | Type | Issue / File |
|---|---|---|---|
| 1 | 🟠 Medium | Code | AC 3 not met: form fields (fromAmount/fromToken/toToken) not cleared unconditionally on tab switch |
| 2 | 🟢 Low | Code | packages/widget/src/stores/navigationTabs/useNavigationTabsStore.tsx — navigationTabs not memoized, unstable reference in useMemo deps |
1. [Medium] AC 3 — Form fields not cleared unconditionally on tab switch
The AC states: "Switching tabs re-applies the active tab's config and clears the form fields (fromAmount / fromToken / toToken)."
The current implementation does not do this unconditionally. FormStoreProvider only includes form fields in reactiveFormValues (and therefore in setUserAndDefaultValues) when Object.hasOwn(tabConfig, '<field>') is true. For a typical tab config such as { mode: 'default', variant: 'wide' }, none of fromAmount, fromToken, or toToken are own properties of the merged tabConfig, so FormUpdater never resets them. The user's field selections persist unchanged after switching tabs.
For clearing to work under the current implementation, an integrator must explicitly include { fromToken: undefined, fromAmount: undefined, toToken: undefined } in every tab config — this is unintuitive, undocumented, and directly contradicts the AC.
Suggested fix: Add a useEffect in NavigationTabsStoreProvider (or HeaderNavigationTabs) that fires when activeTab changes and unconditionally resets those three fields. Alternatively, if the intended design is integrator opt-in, update the AC/documentation to clarify this and add a JSDoc example to NavigationTabConfig.
2. [Low] Unstable navigationTabs reference in tabConfig useMemo deps
In useNavigationTabsStore.tsx, navigationTabs is computed inline on every render via getNavigationTabs(config). When this returns [] (no tabs configured, non-split mode), each call produces a new array reference, which causes the tabConfig useMemo to re-execute on every render even when nothing has changed. The correctness impact is zero (the memo always returns the same stable widgetConfig reference in this path), but it is unnecessary work on every render of NavigationTabsStoreProvider.
Fix: Return a module-level empty-array constant from getNavigationTabs when returning [] (analogous to the existing splitTabs constant), or wrap the call: const navigationTabs = useMemo(() => getNavigationTabs(config), [config]).
💡 Once you've addressed the items above, re-apply the "Agent Review Request" label to trigger an automated re-review.
|
Thanks for the review. Addressed below: 1. [Medium] Form fields not cleared on tab switch — not reproducing; already handled. 2. [Low] Memoize the empty 3. [Advisory] Document non-effective fields on |
There was a problem hiding this comment.
All AC items confirmed met. Original Issue 1 (form-field clearing) was a false positive — HeaderTabs.handleChange clears fields unconditionally. Issue 2 accepted with justification. Issue 3 (JSDoc) done in dfc0e3c. ✅ QA Pass.
Which Linear task is linked to this PR?
https://linear.app/lifi-linear/issue/EMB-465/per-tab-config-for-header-navigation-tabs
Why was it implemented this way?
This PR applies the tab configuration for internally supported navigation tabs for Jumper.
NB: use this SDK type change to pass private flag for "Private" tab: lifinance/sdk#411
Visual showcase (Screenshots or Videos)
N/A
Checklist before requesting a review