PHANTOM
🇮🇳 IN
Skip to content

feat(ui): Immutable attributes in UserProfile#7931

Open
dmoerner wants to merge 2 commits intomainfrom
daniel/user-4766-sdk-support-for-immutable-attributes
Open

feat(ui): Immutable attributes in UserProfile#7931
dmoerner wants to merge 2 commits intomainfrom
daniel/user-4766-sdk-support-for-immutable-attributes

Conversation

@dmoerner
Copy link
Contributor

@dmoerner dmoerner commented Feb 25, 2026

Description

When an attribute is marked as immutable in the user settings, do not allow users to add, remove, or edit it. We currently support phone number, email address, and username. Do not show the three dot action menu if there are no available actions.

Sample screenshot with username, phone, and email immutable. Note that there is no add button, nor is there an action menu to remove:

Screenshot 2026-02-25 at 14-46-57 clerk-js Sandbox

Sample screenshot with same settings, but with two emails on account. Now the action menu is rendered, but the only option is to change which email is primary (which we do not block if an attribute is immutable):

Screenshot 2026-02-25 at 14-47-45 clerk-js Sandbox

If a user tries to connect an OAuth account which would add a new email address to their profile, we follow the existing patterns and display the apierror. There are no new UI changes here, as per the design.

Screenshot 2026-02-25 at 14-55-52 clerk-js Sandbox

Checklist

  • pnpm test runs as expected.
  • pnpm build runs as expected.
  • (If applicable) JSDoc comments have been added or updated for any package exports
  • (If applicable) Documentation has been updated

Type of change

  • 🐛 Bug fix
  • 🌟 New feature
  • 🔨 Breaking change
  • 📖 Refactoring / dependency upgrade / documentation
  • other:

Summary by CodeRabbit

  • New Features

    • User profile attributes can be marked immutable: delete/create/edit actions are disabled and usernames render read-only when protected.
  • Tests

    • Added tests covering immutable behavior for emails, phones, and usernames to validate UI restrictions.
  • Chores

    • Version bumps and a changelog note describing prevention of modification for immutable attributes.

@vercel
Copy link

vercel bot commented Feb 25, 2026

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

Project Deployment Actions Updated (UTC)
clerk-js-sandbox Ready Ready Preview, Comment Feb 25, 2026 8:34pm

Request Review

@changeset-bot
Copy link

changeset-bot bot commented Feb 25, 2026

🦋 Changeset detected

Latest commit: d4f717d

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 20 packages
Name Type
@clerk/clerk-js Minor
@clerk/shared Minor
@clerk/ui Minor
@clerk/chrome-extension Patch
@clerk/expo Patch
@clerk/agent-toolkit Patch
@clerk/astro Patch
@clerk/backend Patch
@clerk/expo-passkeys Patch
@clerk/express Patch
@clerk/fastify Patch
@clerk/localizations Patch
@clerk/msw Patch
@clerk/nextjs Patch
@clerk/nuxt Patch
@clerk/react-router Patch
@clerk/react Patch
@clerk/tanstack-react-start Patch
@clerk/testing Patch
@clerk/vue Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@dmoerner dmoerner marked this pull request as ready for review February 25, 2026 20:21
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 25, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 44fd6f3 and d4f717d.

📒 Files selected for processing (1)
  • packages/ui/src/components/UserProfile/AccountPage.tsx

📝 Walkthrough

Walkthrough

This PR prevents modification of immutable user attributes. It adds an optional immutable?: boolean to AttributeDataJSON, exposes immutableAttributes: Set<string> on the UserProfile context, and updates AccountPage to derive immutability for username, emails, and phones. UsernameSection, EmailsSection, and PhoneSection now accept immutability-related props to disable creation/deletion or render read‑only UI. Tests for immutable email, phone, and username behaviors are added. A changeset bumps minor package versions and adds a changelog note.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat(ui): Immutable attributes in UserProfile' accurately and concisely summarizes the main feature being added—preventing modification of immutable attributes in the UserProfile component.
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.


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

Copy link
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

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/ui/src/components/UserProfile/AccountPage.tsx`:
- Line 34: Remove the debug console.log from the render path in AccountPage.tsx:
eliminate the line logging immutableAttributes (console.log('[clerk-ui]
immutableAttributes:', [...immutableAttributes])); instead, if you need
non-production diagnostics, move logging out of the render flow into a
development-only guard (e.g., check process.env.NODE_ENV === 'development') or
use the project's logger utility and log at a non-verbose level outside the
component render (referencing immutableAttributes and the AccountPage component
to locate the code).

ℹ️ Review info

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 06a633e and 44fd6f3.

📒 Files selected for processing (10)
  • .changeset/bumpy-wings-travel.md
  • packages/shared/src/types/userSettings.ts
  • packages/ui/src/components/UserProfile/AccountPage.tsx
  • packages/ui/src/components/UserProfile/EmailsSection.tsx
  • packages/ui/src/components/UserProfile/PhoneSection.tsx
  • packages/ui/src/components/UserProfile/UsernameSection.tsx
  • packages/ui/src/components/UserProfile/__tests__/EmailsSection.test.tsx
  • packages/ui/src/components/UserProfile/__tests__/PhoneSection.test.tsx
  • packages/ui/src/components/UserProfile/__tests__/UsernameSection.test.tsx
  • packages/ui/src/contexts/components/UserProfile.ts

@pkg-pr-new
Copy link

pkg-pr-new bot commented Feb 25, 2026

Open in StackBlitz

@clerk/agent-toolkit

npm i https://pkg.pr.new/@clerk/agent-toolkit@7931

@clerk/astro

npm i https://pkg.pr.new/@clerk/astro@7931

@clerk/backend

npm i https://pkg.pr.new/@clerk/backend@7931

@clerk/chrome-extension

npm i https://pkg.pr.new/@clerk/chrome-extension@7931

@clerk/clerk-js

npm i https://pkg.pr.new/@clerk/clerk-js@7931

@clerk/dev-cli

npm i https://pkg.pr.new/@clerk/dev-cli@7931

@clerk/expo

npm i https://pkg.pr.new/@clerk/expo@7931

@clerk/expo-passkeys

npm i https://pkg.pr.new/@clerk/expo-passkeys@7931

@clerk/express

npm i https://pkg.pr.new/@clerk/express@7931

@clerk/fastify

npm i https://pkg.pr.new/@clerk/fastify@7931

@clerk/hono

npm i https://pkg.pr.new/@clerk/hono@7931

@clerk/localizations

npm i https://pkg.pr.new/@clerk/localizations@7931

@clerk/nextjs

npm i https://pkg.pr.new/@clerk/nextjs@7931

@clerk/nuxt

npm i https://pkg.pr.new/@clerk/nuxt@7931

@clerk/react

npm i https://pkg.pr.new/@clerk/react@7931

@clerk/react-router

npm i https://pkg.pr.new/@clerk/react-router@7931

@clerk/shared

npm i https://pkg.pr.new/@clerk/shared@7931

@clerk/tanstack-react-start

npm i https://pkg.pr.new/@clerk/tanstack-react-start@7931

@clerk/testing

npm i https://pkg.pr.new/@clerk/testing@7931

@clerk/ui

npm i https://pkg.pr.new/@clerk/ui@7931

@clerk/upgrade

npm i https://pkg.pr.new/@clerk/upgrade@7931

@clerk/vue

npm i https://pkg.pr.new/@clerk/vue@7931

commit: d4f717d

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant