-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Collection: prevent multiple load calls within a very short time #20528
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
Collection: prevent multiple load calls within a very short time #20528
Conversation
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 debounces collection loading to prevent multiple rapid server calls triggered by async filter/orderBy initialization, and deprecates the public requestCollection API in favor of a debounced loadCollection. It also removes a redundant collection reload after media upload completion.
- Introduces debounced loadCollection on UmbDefaultCollectionContext and deprecates requestCollection.
- Updates document/media collection contexts to forward deprecated calls to a new protected _requestCollection.
- Removes an extra requestCollection invocation on media upload completion to avoid duplicate requests.
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Umbraco.Web.UI.Client/src/packages/media/media/collection/media-collection.element.ts | Removes a redundant collection reload after upload completion to avoid duplicate requests. |
| src/Umbraco.Web.UI.Client/src/packages/media/media/collection/media-collection.context.ts | Deprecates requestCollection and introduces protected _requestCollection; adds deprecation warning. |
| src/Umbraco.Web.UI.Client/src/packages/documents/documents/collection/document-collection.context.ts | Deprecates requestCollection and forwards to protected _requestCollection; updates super call accordingly. |
| src/Umbraco.Web.UI.Client/src/packages/core/collection/default/collection-default.element.ts | Switches initial load from requestCollection to debounced loadCollection. |
| src/Umbraco.Web.UI.Client/src/packages/core/collection/default/collection-default.context.ts | Adds debounced loadCollection, deprecates requestCollection, and routes internal calls to _requestCollection. |
src/Umbraco.Web.UI.Client/src/packages/core/collection/default/collection-default.element.ts
Show resolved
Hide resolved
src/Umbraco.Web.UI.Client/src/packages/core/collection/default/collection-default.context.ts
Show resolved
Hide resolved
src/Umbraco.Web.UI.Client/src/packages/core/collection/default/collection-default.context.ts
Outdated
Show resolved
Hide resolved
…/collection-default.context.ts Co-authored-by: Copilot <[email protected]>
Due to the extendable and async collection
filter/orderByinitialization, multiple calls to therequestCollectionmethod can occur within a very short period. This can result in several server calls, with combined arguments generated by the filters.This PR replicates the solution from the tree context to prevent multiple load calls within a short timeframe. We achieve this by debouncing the load method.
I also noticed that the Media Collection Context both dispatched an event and called
requestCollectionafter the upload was completed. This resulted in multiple server requests. I have removed therequestCollectioncall because the event covers both the collection and the sidebar menu.The PR deprecates the public requestCollection method on the context and introduces a debounced loadCollection instead.
How to Test: