-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Collection rendering performance improvements Part 1: Improve Entity actions render performance #19605
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
The render method now checks for the presence of both editPath and _name before rendering the button, preventing potential errors when these values are missing.
Replaces the public 'open' property with a private field and getter/setter to better control dropdown state. Moves popover open/close logic into the setter, removes the 'updated' lifecycle method, and conditionally renders dropdown content based on the open state.
Introduces an _isOpen state to control rendering of the dropdown content in UmbEntityActionsBundleElement. Dropdown content is now only rendered when the dropdown is open, improving performance and preventing unnecessary DOM updates.
Adds an IntersectionObserver to only observe entity actions when the element is in the viewport, improving performance. Refactors element creation to use constructors, updates event handling, and ensures cleanup in disconnectedCallback.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR improves the rendering performance of Entity Actions in collections by deferring the creation and rendering of associated action APIs until needed. Key changes include:
- Adding early-return guards in the document table column element to avoid rendering without required properties.
- Replacing the legacy popover implementation with a new umb-entity-actions-dropdown component in the workspace entity action menu.
- Introducing an IntersectionObserver in the entity actions bundle to delay observing entity actions until the element is in the viewport, along with new event types and refactored dropdown behaviors.
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
document-table-column-name.element.ts | Added guard checks for value.editPath and _name before rendering. |
workspace-entity-action-menu.element.ts | Refactored component to use the new umb-entity-actions-dropdown element. |
opened.event.ts & closed.event.ts | Introduced new events to mimic native toggle behavior. |
index.ts (event) | Exported the new opened and closed events. |
entity-actions-dropdown.element.ts | Added a new dropdown component that programmatically creates and caches its content on open. |
entity-actions-bundle.element.ts | Integrated an IntersectionObserver for lazy initialization and replaced legacy dropdown usage. |
dropdown.element.ts | Refactored open/close logic with a private open state and event dispatching. |
Comments suppressed due to low confidence (2)
src/Umbraco.Web.UI.Client/src/packages/core/components/entity-actions-bundle/entity-actions-bundle.element.ts:41
- Consider disconnecting the IntersectionObserver in the element's disconnectedCallback to avoid potential memory leaks when the element is removed from the DOM.
const observer = new IntersectionObserver(
src/Umbraco.Web.UI.Client/src/packages/core/components/dropdown/dropdown.element.ts:21
- [nitpick] Review the open property setter logic to ensure it does not conflict with the toggle event handler, preventing redundant calls to openDropdown or closeDropdown.
public set open(value) {
Note
Requires the latest version of the UI Library with this PR merged: umbraco/Umbraco.UI#1129.
If testing without the latest UI Library version, the Entity Action popover will, in some cases, be positioned off-screen.
This PR makes sure that the Entity Actions list is only rendered when the popover is open.
Optimizations
Poor man's performance stats from my computer:
Before the optimization, I started having trouble rendering a collection and selecting items when there were 100+ items. This also made the rest of the backoffice nearly unusable—I couldn’t navigate around properly.
After the entity action optimizations, I now only start seeing issues around 500–1000 items. I’ve been able to render a list with 2000 items (with a very long table render time), but I was still able to select items (with some delay) but afterwards navigating the rest of the backoffice fine.
Once we reach 500+ items, we’ll need to do a separate investigation into what’s causing the slow rendering of table items.