fix(kyc): actually apply the callback-ref fix (#2440 shipped the test only)#2441
Conversation
… only) #2440 was meant to fix the card outage but landed the regression test WITHOUT the code change: while proving the test failed against prod, a `git checkout origin/main -- SumsubKycWrapper.tsx` staged the reverted file, and the follow-up commit swept that staged revert in. Net effect: main got a test asserting behaviour that main does not have. Its unit job is red and the outage is still live. Re-applies the fix on top of main, unchanged from what #2440 intended: hold the SDK container in state via a callback ref so the init effect re-runs when the headlessui portal attaches the node a commit after `visible` flips. Without it the effect reads a null ref on its only run, never re-runs (a ref is not reactive and is not a dep), and the SDK is never launched — every user gets an infinite spinner (card_sumsub_opened normal, card_sumsub_completed 0). Verified the honest way this time: the test ALREADY on main fails against main's wrapper (launch called 0 times) and passes with this commit.
|
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthrough
ChangesSumsub SDK container lifecycle
Estimated code review effort: 2 (Simple) | ~10 minutes Suggested reviewers: ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint install failed: dependency version conflict. Check your lock file or package.json. Comment |
Code-analysis diffPainscore total: 6207.05 → 6207.05 (0) |
🧪 UI test report — ✅ all greenSuites
📊 Coverage (unit)
⏱ 10 slowest test cases
|
The card outage is still live. #2440 was supposed to fix it, but it merged the regression test without the code change.
How: while proving the test failed against prod code, I ran
git checkout origin/main -- SumsubKycWrapper.tsx. That staged the reverted file. I restored the working tree withcpbut never re-staged, so the follow-up commit swept the staged revert in.mainended up with a test asserting behaviourmaindoesn't have → its unit job is red, and every user still gets the spinner.The fix (unchanged from what #2440 intended)
Hold the SDK container in state via a callback ref so the init effect re-runs when the headlessui portal attaches the node — which happens a commit after
visibleflips true.Without it: the effect reads a
nullref on its only run and never re-runs (a ref isn't reactive and isn't in the dep array) →sdk.launch()is never called → infinite spinner for 100% of users.Deterministic, not a race — every
useSumsubKycFlowcall site does:so
accessToken+visibleland together whilesdkLoadedis already true (the wrapper is persistently mounted). All deps ready, container null, effect bails, done.Matches prod exactly:
card_sumsub_openednormal (137/day) vscard_sumsub_completed0 (was 49–85/day),kyc_approved0, cards 0 for 16h+.Not Sumsub
Ruled out by direct API probe — the
rain-requirementslevel is healthy:Nothing renamed or deleted. Applicants with empty questionnaires are at
reviewStatus: init— they never submitted, because the SDK never launched. That's the symptom, not the cause. Do not edit the Sumsub dashboard.Verification
launchcalled 0 times) and passes with this commit. That asymmetry is the proof the code change is really here.Risk
One file, 18 lines, Sumsub modal only. No API/contract change, no migration. Targets
main→ back-merge debt (main→dev).Summary by CodeRabbit