Skip to content

Fixed back stack navigation issue in Add Authenticator's SDK#27

Merged
Sudhanshu96 merged 1 commit into
mainfrom
bugfix/back_navigation_fix
May 25, 2026
Merged

Fixed back stack navigation issue in Add Authenticator's SDK#27
Sudhanshu96 merged 1 commit into
mainfrom
bugfix/back_navigation_fix

Conversation

@Sudhanshu96

@Sudhanshu96 Sudhanshu96 commented May 21, 2026

Copy link
Copy Markdown
Contributor
  • All new/changed/fixed functionality is covered by tests (or N/A)
  • I have added documentation for all new/changed functionality (or N/A)

📋 Changes

Fixed back stack navigation issue in Add Authenticator's SDK

📹 Video

back_navigation_issue_resolved.mov

@Sudhanshu96
Sudhanshu96 requested a review from a team as a code owner May 21, 2026 13:16
/// In embedded mode, only removes entries added since `useExternalPath(_:)` was
/// called, leaving the host-app entries intact so the host stack is undisturbed.
func popToSDKRoot() {
if let ext = externalPath {

@NandanPrabhu NandanPrabhu May 25, 2026

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.

@Sudhanshu96 useExternalPath sets internalExternalPathCount same as externalPath.wrapperValue.count. When does internalExternalPathCount become less than externalPath.wrapperValue.count?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

When the host app already has NavigationStack then initialExternalPathCount marks the boundary — so popToSDKRoot() knows to only remove the SDK's routes without disturbing the host app's navigation.

This piece of code:

let toRemove = ext.wrappedValue.count - initialExternalPathCount
guard toRemove > 0 else { return }

caters to the case or rather protects against calling popToSDKRoot() when already at SDK root (no SDK routes pushed) otherwise the hoes app's navigation would get affected thus providing a bad user expereince.

@Sudhanshu96
Sudhanshu96 merged commit 611a3e3 into main May 25, 2026
8 checks passed
@Sudhanshu96
Sudhanshu96 deleted the bugfix/back_navigation_fix branch May 25, 2026 09:15
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.

2 participants