Skip to content

Fix: Navigating to account recovery#1934

Merged
seshanthS merged 2 commits intodevfrom
fix/recovery-required
Apr 7, 2026
Merged

Fix: Navigating to account recovery#1934
seshanthS merged 2 commits intodevfrom
fix/recovery-required

Conversation

@seshanthS
Copy link
Copy Markdown
Collaborator

@seshanthS seshanthS commented Apr 7, 2026

Summary

Fixes - wrongly navigating to Recovery required screen in mock passport flow.

  • Remove manual dsc to register chaining in mock document flow of the webview-app.
  • Adds a delay before navigating to /disclose to allow the tree reader to index the onchain event.

Test plan


Native Consolidation Checklist

  • CONTRACTS.md reviewed - no unintended contract changes
  • Layer 1 bridge contract tests pass (cd app && yarn jest:run / yarn workspace @selfxyz/rn-sdk-test-app test)
  • Layer 3 builds pass (app iOS, RN test app iOS, RN test app Android)
  • Layer 4 manual smoke test signed off (if consolidation PR)
  • No new native business logic added (logic belongs in TypeScript)

Summary by CodeRabbit

  • Refactor
    • Streamlined tunnel registration completion flow by removing redundant intermediate steps.
    • Added 5-second delay before navigating to proof disclosure screen.
    • Enhanced analytics event tracking for registration completion milestones.

@seshanthS seshanthS requested a review from shazarre April 7, 2026 11:35
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 7, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
self-webview-app Ready Ready Preview, Comment Apr 7, 2026 11:35am

Request Review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 7, 2026

📝 Walkthrough

Walkthrough

Simplified completion state handling in TunnelProvingScreen by consolidating two-phase transitions into single-path navigation. Removed conditional phase-based logic, registration re-initialization call, and associated error handling. Added analytics event and 5-second navigation delay.

Changes

Cohort / File(s) Summary
TunnelProvingScreen Completion Flow
packages/webview-app/src/screens/tunnel/TunnelProvingScreen.tsx
Replaced phase-dependent completion transitions with unified flow triggered by currentState === 'completed'. Removed init(client, 'register', true) call for registration phase and its error handling. Now dispatches analytics event and schedules navigation via setTimeout. Dependency list modified by removing client and init from effect dependencies.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'Fix: Navigating to account recovery' is vague and generic, using non-descriptive language that doesn't convey the actual changes made (removing DSC-to-register chaining and adding navigation delay). Clarify the title to specifically reference the core fix, such as 'Remove manual DSC-to-register chaining in tunnel proving' or 'Fix: Simplify tunnel proving completion flow'.
✅ Passed checks (2 passed)
Check name Status Explanation
Description check ✅ Passed The description includes all required template sections with substantive content in the Summary and an appropriately unchecked Native Consolidation Checklist, though Test plan details are minimal.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/recovery-required

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.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: ce5e2c4e-1bd0-4215-8b2c-832ce527fb9e

📥 Commits

Reviewing files that changed from the base of the PR and between 40f283b and 510d272.

📒 Files selected for processing (1)
  • packages/webview-app/src/screens/tunnel/TunnelProvingScreen.tsx

Comment on lines +107 to +113
} else if (currentState === 'completed') {
analytics.trackEvent('tunnel_proving_registration_complete', { previousPhase: phase });
// Brief delay to allow tree reader to index the on-chain commitment
// before disclose fetches the identity tree.
setTimeout(() => navigate('/tunnel/proof/disclose', { replace: true }), 5000);
}
}, [currentState, initDone, phase, client, init, analytics, haptic, navigate, errorCode, reason, navigateToError]);
}, [currentState, initDone, phase, analytics, haptic, navigate, errorCode, reason, navigateToError]);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Missing cleanup for setTimeout causes navigation after unmount.

The 5-second setTimeout at line 111 isn't cleared if the component unmounts before it fires. This will trigger navigation on an unmounted component, causing React warnings and unexpected navigation behavior if the user has already left this screen.

Proposed fix
   } else if (currentState === 'completed') {
     analytics.trackEvent('tunnel_proving_registration_complete', { previousPhase: phase });
     // Brief delay to allow tree reader to index the on-chain commitment
     // before disclose fetches the identity tree.
-    setTimeout(() => navigate('/tunnel/proof/disclose', { replace: true }), 5000);
+    const timeoutId = setTimeout(() => navigate('/tunnel/proof/disclose', { replace: true }), 5000);
+    return () => clearTimeout(timeoutId);
   }
-}, [currentState, initDone, phase, analytics, haptic, navigate, errorCode, reason, navigateToError]);
+  }, [currentState, initDone, phase, analytics, haptic, navigate, errorCode, reason, navigateToError]);
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
} else if (currentState === 'completed') {
analytics.trackEvent('tunnel_proving_registration_complete', { previousPhase: phase });
// Brief delay to allow tree reader to index the on-chain commitment
// before disclose fetches the identity tree.
setTimeout(() => navigate('/tunnel/proof/disclose', { replace: true }), 5000);
}
}, [currentState, initDone, phase, client, init, analytics, haptic, navigate, errorCode, reason, navigateToError]);
}, [currentState, initDone, phase, analytics, haptic, navigate, errorCode, reason, navigateToError]);
useEffect(() => {
// ... existing code ...
let timeoutId: NodeJS.Timeout | undefined;
if (currentState === 'completed') {
analytics.trackEvent('tunnel_proving_registration_complete', { previousPhase: phase });
// Brief delay to allow tree reader to index the on-chain commitment
// before disclose fetches the identity tree.
timeoutId = setTimeout(() => navigate('/tunnel/proof/disclose', { replace: true }), 5000);
}
return () => {
if (timeoutId) clearTimeout(timeoutId);
};
}, [currentState, initDone, phase, analytics, haptic, navigate, errorCode, reason, navigateToError]);

state: currentState,
});
navigateToError(reason ?? errorCode ?? currentState);
} else if (currentState === 'completed' && phase === 'dsc') {
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing this because the dsc to register process happens inside the provingMachine. We don't need to start init provingMachine with register.

For the KYC flow, the currentState will transition to completed once the register step is completed.

For the mock passport flow, the currentState will transition to completed when both the dsc and register steps are completed.

@seshanthS seshanthS merged commit 147b593 into dev Apr 7, 2026
23 checks passed
@seshanthS seshanthS deleted the fix/recovery-required branch April 7, 2026 17:10
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