Skip to content

Comments

[Feature] UI - User Dropdown: Gate 'Hide All Prompts' to enterprise users#21842

Open
yuneng-jiang wants to merge 3 commits intomainfrom
litellm_hide_prompts_enterprise_yj
Open

[Feature] UI - User Dropdown: Gate 'Hide All Prompts' to enterprise users#21842
yuneng-jiang wants to merge 3 commits intomainfrom
litellm_hide_prompts_enterprise_yj

Conversation

@yuneng-jiang
Copy link
Collaborator

Summary

The "Hide All Prompts" toggle in the user dropdown was accessible to all users but had no effect for non-enterprise users. This restricts the feature so that:

  • Enterprise users have prompts hidden by default and can toggle the setting on or off.
  • Non-enterprise users always see prompts and cannot change this setting.
  • The toggle is disabled with an info icon tooltip and an "Enterprise" tag for non-enterprise users.

Changes

  • useDisableShowPrompts: Enterprise users now default to true (prompts hidden) when no stored preference exists. Non-enterprise users always return false.
  • UserDropdown: The "Hide All Prompts" switch is disabled for non-enterprise users and shows an info icon tooltip and an Enterprise tag. The toggle handler now stores "false" explicitly (instead of removing the key) so the enterprise default-on logic is not accidentally re-triggered.
  • Tests updated to reflect the new behavior.

Testing

  • useDisableShowPrompts.test.ts: Covers default-on for enterprise, always-off for non-enterprise, and toggling behavior.
  • UserDropdown.test.tsx: Toggle tests now set premiumUser: true and assert setLocalStorageItem("disableShowPrompts", "false") for the off case.
  • organization_view.test.tsx: Empty state test now navigates to the Members tab before asserting.

Type

🆕 New Feature
✅ Test

@vercel
Copy link

vercel bot commented Feb 21, 2026

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

Project Deployment Actions Updated (UTC)
litellm Ready Ready Preview, Comment Feb 21, 2026 11:01pm

Request Review

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Feb 21, 2026

Greptile Summary

Gates the "Hide All Prompts" toggle in the user dropdown to enterprise (premium) users only. Enterprise users now have prompts hidden by default (opt-out), while non-enterprise users always see prompts with the toggle disabled. Includes a minor bug fix in handle_add_auto_router_submit.tsx removing an invalid second argument to NotificationManager.fromBackend(), and removes a broken test in organization_view.test.tsx that asserted on text not present in the component.

  • useDisableShowPrompts hook now checks premiumUser from useAuthorized: non-premium always returns false; premium defaults to true when no localStorage preference is stored
  • UserDropdown disables the switch for non-premium users and shows an info tooltip + "Enterprise" tag
  • Toggle-off now stores "false" explicitly instead of removing the key, preventing re-triggering of the default-on logic
  • Added getServerSnapshot to useSyncExternalStore for proper SSR/Next.js compatibility
  • Tests updated to cover premium/non-premium/loading states and the new toggle behavior

Confidence Score: 4/5

  • This PR is safe to merge — it's a UI-only feature gate with good test coverage and no backend changes.
  • The core logic change is straightforward and well-tested. The enterprise gating correctly handles all three states of premiumUser (true, false, null). The behavioral change (default-on for enterprise users) is intentional and documented. Only minor style issues found (redundant guard, unused import). No security, performance, or backend concerns.
  • No files require special attention. The useDisableShowPrompts.ts hook is the key logic file and has comprehensive test coverage.

Important Files Changed

Filename Overview
ui/litellm-dashboard/src/app/(dashboard)/hooks/useDisableShowPrompts.ts Added enterprise gating: non-premium users always return false; premium users default to true (prompts hidden) when no stored preference exists. Added getServerSnapshot for SSR compatibility.
ui/litellm-dashboard/src/components/Navbar/UserDropdown/UserDropdown.tsx Disabled "Hide All Prompts" switch for non-premium users with tooltip and Enterprise tag. Toggle now stores explicit "false" instead of removing the key. Minor formatting cleanup throughout.
ui/litellm-dashboard/src/app/(dashboard)/hooks/useDisableShowPrompts.test.ts Tests reorganized into non-premium, premium, and loading state groups. Good coverage of default-on behavior, explicit toggle, and event listener scenarios.
ui/litellm-dashboard/src/components/Navbar/UserDropdown/UserDropdown.test.tsx Toggle tests now set premiumUser: true for hide-prompts tests. Toggle-off assertion changed from removeLocalStorageItem to setLocalStorageItem with "false".
ui/litellm-dashboard/src/components/add_model/handle_add_auto_router_submit.tsx Removed invalid second argument "success" from NotificationManager.fromBackend() call, and minor whitespace cleanup.
ui/litellm-dashboard/src/components/organization/organization_view.test.tsx Removed test for "No members found" empty state which referenced text that doesn't exist in the component. Added unused userEvent import.
ui/litellm-dashboard/package.json Added dev:webpack script for alternative webpack-based dev server.
ui/litellm-dashboard/package-lock.json Lock file regeneration marking several packages as dev-only dependencies.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[useDisableShowPrompts hook called] --> B{premiumUser?}
    B -->|null / false| C[Return false\nPrompts always shown]
    B -->|true| D{localStorage\ndisableShowPrompts}
    D -->|null / absent| E[Return true\nDefault: prompts hidden]
    D -->|"true"| F[Return true\nPrompts hidden]
    D -->|"false"| G[Return false\nUser opted to show]

    H[UserDropdown Switch] --> I{premiumUser?}
    I -->|false / null| J[Switch disabled\n+ Enterprise tag\n+ Info tooltip]
    I -->|true| K[Switch enabled]
    K -->|Toggle ON| L[setLocalStorageItem\ndisableShowPrompts = true]
    K -->|Toggle OFF| M[setLocalStorageItem\ndisableShowPrompts = false]
Loading

Last reviewed commit: 118775b

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

8 files reviewed, 2 comments

Edit Code Review Agent Settings | Greptile

Comment on lines 129 to +131
onChange={(checked) => {
if (checked) {
setLocalStorageItem("disableShowPrompts", "true");
emitLocalStorageChange("disableShowPrompts");
} else {
removeLocalStorageItem("disableShowPrompts");
emitLocalStorageChange("disableShowPrompts");
}
if (!premiumUser) return;
setLocalStorageItem("disableShowPrompts", checked ? "true" : "false");
Copy link
Contributor

Choose a reason for hiding this comment

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

Redundant guard on disabled switch

The if (!premiumUser) return; check on line 130 is unnecessary since the switch is already disabled={!premiumUser} on line 128. The onChange handler will never fire for non-premium users when the switch is disabled by Ant Design. Consider removing the guard to reduce dead code.

Suggested change
onChange={(checked) => {
if (checked) {
setLocalStorageItem("disableShowPrompts", "true");
emitLocalStorageChange("disableShowPrompts");
} else {
removeLocalStorageItem("disableShowPrompts");
emitLocalStorageChange("disableShowPrompts");
}
if (!premiumUser) return;
setLocalStorageItem("disableShowPrompts", checked ? "true" : "false");
onChange={(checked) => {
setLocalStorageItem("disableShowPrompts", checked ? "true" : "false");
emitLocalStorageChange("disableShowPrompts");

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

…view.test.tsx

Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
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