Skip to content

Remove forceMount from UserDropdown DropdownMenuContent #1150

@MODSetter

Description

@MODSetter

Description

In UserDropdown.tsx, the DropdownMenuContent uses forceMount (line 66), which keeps the dropdown DOM mounted even when closed. This adds unnecessary nodes to the DOM tree at all times.

File to change

  • surfsense_web/components/UserDropdown.tsx (line 66)

Current code

<DropdownMenuContent className="w-44 md:w-56" align="end" forceMount>

What to do

<DropdownMenuContent className="w-44 md:w-56" align="end">

Simply remove forceMount. Radix will mount the content only when the dropdown is open (the default behavior).

Note: If forceMount was added for animation purposes, use Radix's data-state CSS attributes for open/close animations instead.

Acceptance criteria

  • forceMount is removed
  • Dropdown still opens/closes correctly
  • Dropdown content is not in the DOM when closed

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions