Skip to content

fix: smooth manage account transitions and email creation - #868

Merged
swolfand merged 4 commits into
mainfrom
sam/mobile-621-manage-account-stutter
Aug 11, 2026
Merged

fix: smooth manage account transitions and email creation#868
swolfand merged 4 commits into
mainfrom
sam/mobile-621-manage-account-stutter

Conversation

@swolfand

@swolfand swolfand commented Aug 10, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • keep the account and Manage account surfaces mounted and animate only their horizontal layer translations
  • retain Navigation3 for the rest of the user-profile routes and preserve forward, back-button, and system-back slides
  • render Manage account as one flattened lazy list with stable row keys and content types
  • defer row ViewModels, action menus, remote provider logos, and client refresh until ordinary navigation destinations settle
  • memoize resolved Clerk and Material theme objects across recompositions
  • send the active session ID when creating an email address instead of the current user ID
  • add high-cardinality, transition-state, and create-email session regression coverage

Why

The customer has enough email addresses and connected accounts that entering Manage account eagerly composed and measured substantial row content while the navigation transition was already running. Lazy rendering removed the sustained work, but destination setup still produced a visible hitch at the start of the slide.

The final transition keeps both profile surfaces at fixed full-screen positions and moves their existing graphics layers. Manage account is prepared offscreen before the user taps Profile, so the animation does not create, measure, or tear down high-cardinality content. Other profile destinations continue to use the existing Navigation3 stack.

While validating the flow, adding an email returned authentication_invalid because _clerk_session_id was populated with a user_... ID. The create-email endpoint now defaults to the active sess_... ID, consistent with the other user endpoints.

Impact

Forward and reverse Manage account transitions retain the requested slide while avoiding composition and layout work during the animation. The list remains lazy and preserves its layout, scrolling, actions, and refresh behavior. Creating an email address now sends the authentication context expected by the backend.

MOBILE-621

Screen_recording_20260810_173104.mp4

Summary by CodeRabbit

  • New Features

    • Added smoother animated transitions and system back navigation for profile detail screens.
    • Improved profile sections and account rows for viewing during navigation and non-interactive states.
    • Added more efficient list rendering for emails, phone numbers, and connected accounts.
  • Bug Fixes

    • Email address creation now correctly uses the active session ID by default.
  • Performance

    • Improved theme consistency and reduced unnecessary recalculation during UI updates.

Flatten profile detail sections into keyed lazy-list items so users with many identifiers and connected accounts do not compose off-screen rows during navigation. Add high-cardinality regression coverage.
@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The API now defaults email-address creation to the active session ID. The profile UI now uses memoized themes, keyed lazy lists, non-interactive rows during navigation, and an animated detail overlay with back handling.

Changes

API session resolution

Layer / File(s) Summary
Active session ID default and validation
source/api/src/main/kotlin/.../UserApi.kt, source/api/src/test/java/.../UserApiTest.kt
createEmailAddress now uses Clerk.session?.id by default. A coroutine test verifies this behavior.

Profile rendering and navigation

Layer / File(s) Summary
Memoized theme resolution
source/ui/src/main/java/com/clerk/ui/theme/*, source/ui/src/test/java/com/clerk/ui/theme/*
Theme colors, typography, design, and Material color schemes are memoized. Dark-mode changes invalidate color calculations.
Lazy profile sections and non-interactive rows
source/ui/src/main/java/com/clerk/ui/userprofile/common/*, .../connectedaccount/*, .../email/*, .../phone/*, source/ui/src/test/java/com/clerk/ui/userprofile/*
Profile sections now emit keyed lazy-list items. Email, phone, and external-account rows can render without interaction state or view models.
Lifecycle-aware detail content
source/ui/src/main/java/com/clerk/ui/userprofile/detail/UserProfileDetailView.kt
The detail view uses LazyColumn, refreshes at RESUMED, and enables interaction after navigation settles.
Animated detail overlay
source/ui/src/main/java/com/clerk/ui/userprofile/UserProfileView.kt
The profile view animates the detail overlay, handles detail back actions, and routes profile actions through onShowDetail.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant UserProfileView
  participant UserProfileDetailViewWithBackHandler
  participant ProfileSections
  User->>UserProfileView: select profile action
  UserProfileView->>UserProfileDetailViewWithBackHandler: show animated detail overlay
  UserProfileDetailViewWithBackHandler->>ProfileSections: render lazy profile sections
  ProfileSections->>ProfileSections: enable interaction when navigation reaches RESUMED
  User->>UserProfileView: press back
  UserProfileView->>UserProfileDetailViewWithBackHandler: hide detail overlay
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the two primary changes: smoother Manage account transitions and corrected email creation behavior.
Description check ✅ Passed The description explains the changes, motivation, impact, testing, and linked issue, although it does not use the template headings exactly.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch sam/mobile-621-manage-account-stutter

Comment @coderabbitai help to get the list of available commands.

Send the active session ID in the create-email request so authenticated profile updates are accepted. Add a regression test covering the default query parameter.
@swolfand swolfand changed the title fix(ui): lazily render manage account rows fix: improve manage account performance and email creation Aug 10, 2026
Delay row view models, menus, remote logos, and client refreshes until the destination is resumed. Memoize resolved theme objects so the profile transition avoids rebuilding stable styling state on every composition.
Keep the account and manage-account surfaces mounted and animate only their layer translations. This prevents high-cardinality account rows from being composed or measured during forward and reverse transitions.
@swolfand swolfand changed the title fix: improve manage account performance and email creation fix: smooth manage account transitions and email creation Aug 10, 2026
@swolfand
swolfand marked this pull request as ready for review August 11, 2026 00:32

@coderabbitai coderabbitai Bot left a comment

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.

🧹 Nitpick comments (1)
source/ui/src/main/java/com/clerk/ui/theme/ClerkThemeProvider.kt (1)

99-100: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick win

Key typography memoization by its actual input.

Use remember(theme?.typography) because generateTypography reads only theme?.typography. This avoids recreating Typography when only colors or design change.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@source/ui/src/main/java/com/clerk/ui/theme/ClerkThemeProvider.kt` around
lines 99 - 100, Update the typography memoization in ClerkThemeProvider around
generateTypography to key remember by theme?.typography rather than the entire
theme. Preserve the existing generateTypography call while ensuring color or
design-only changes do not recreate Typography.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@source/ui/src/main/java/com/clerk/ui/theme/ClerkThemeProvider.kt`:
- Around line 99-100: Update the typography memoization in ClerkThemeProvider
around generateTypography to key remember by theme?.typography rather than the
entire theme. Preserve the existing generateTypography call while ensuring color
or design-only changes do not recreate Typography.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 0653eda1-a04b-4ef3-9de9-f4d6ed2bcfc5

📥 Commits

Reviewing files that changed from the base of the PR and between 11064b7 and 4f11e2d.

📒 Files selected for processing (16)
  • source/api/src/main/kotlin/com/clerk/api/network/api/UserApi.kt
  • source/api/src/test/java/com/clerk/api/network/api/UserApiTest.kt
  • source/ui/src/main/java/com/clerk/ui/theme/ClerkComposeTheme.kt
  • source/ui/src/main/java/com/clerk/ui/theme/ClerkThemeProvider.kt
  • source/ui/src/main/java/com/clerk/ui/userprofile/UserProfileView.kt
  • source/ui/src/main/java/com/clerk/ui/userprofile/common/UserProfileButtonRow.kt
  • source/ui/src/main/java/com/clerk/ui/userprofile/connectedaccount/UserProfileExternalAccountRow.kt
  • source/ui/src/main/java/com/clerk/ui/userprofile/connectedaccount/UserProfileExternalAccountSection.kt
  • source/ui/src/main/java/com/clerk/ui/userprofile/detail/UserProfileDetailView.kt
  • source/ui/src/main/java/com/clerk/ui/userprofile/email/UserProfileEmailRow.kt
  • source/ui/src/main/java/com/clerk/ui/userprofile/email/UserProfileEmailSection.kt
  • source/ui/src/main/java/com/clerk/ui/userprofile/phone/UserProfilePhoneRow.kt
  • source/ui/src/main/java/com/clerk/ui/userprofile/phone/UserProfilePhoneSection.kt
  • source/ui/src/test/java/com/clerk/ui/theme/ClerkThemeSnapshotTest.kt
  • source/ui/src/test/java/com/clerk/ui/userprofile/connectedaccount/UserProfileExternalAccountSectionTest.kt
  • source/ui/src/test/java/com/clerk/ui/userprofile/email/UserProfileEmailRowTest.kt
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

  • clerk/javascript (auto-detected)
  • clerk/dashboard (auto-detected)

@swolfand
swolfand merged commit 4f20c45 into main Aug 11, 2026
16 checks passed
@swolfand
swolfand deleted the sam/mobile-621-manage-account-stutter branch August 11, 2026 01: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.

1 participant