Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Batch item rest requests #19233

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

Open
wants to merge 24 commits into
base: release/16.0
Choose a base branch
from

Conversation

madsrasmussen
Copy link
Contributor

@madsrasmussen madsrasmussen commented May 5, 2025

Fixes:
#19187
#18822

When making a REST GET request, the server has a limitation on the length of a URL. To accommodate this limitation, this PR introduces batching logic for item requests. I have added a new controller, UmbItemDataApiRequestController. I am open to naming suggestions if something else comes up.

The controller takes an array of unique items and cuts it into chunks based on a configured chunk size. It then sends a request to the provided API endpoint. The controller combines the returned data and presents it as one unified data set. It also handles errors and notifies if any of the requests fail.

The controller has been implemented for all item repositories.

@madsrasmussen madsrasmussen marked this pull request as ready for review May 5, 2025 17:54
@Copilot Copilot AI review requested due to automatic review settings May 5, 2025 17:54
Copy link
Contributor

@Copilot Copilot AI left a 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 introduces batching logic for REST GET requests to work around URL length limitations, by implementing a new controller that handles batched item requests and consolidates results.

  • Introduces a new controller for batched API requests using a chunking mechanism.
  • Refactors the getItems method in item data sources to utilize the new controller.
  • Updates and refactors utility modules (batching functions and tryExecute modules) to support batched execution.

Reviewed Changes

Copilot reviewed 36 out of 36 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/Umbraco.Web.UI.Client/src/packages/data-type/repository/item/data-type-item.server.data-source.ts Refactored getItems to use the new UmbItemDataApiGetRequestController for batching item requests.
src/Umbraco.Web.UI.Client/src/packages/core/utils/array/batch-array.ts & test Added batching helpers and tests.
src/Umbraco.Web.UI.Client/src/packages/core/resources/try-execute/* Updated import paths and consolidated try-execute functions.
src/Umbraco.Web.UI.Client/src/packages/core/entity-item/* Added new controller for batched API GET requests and updated related types and indexes.
Other files Adjusted exports and import paths for consistency with the new batching implementation.
Comments suppressed due to low confidence (1)

src/Umbraco.Web.UI.Client/src/packages/data-type/repository/item/data-type-item.server.data-source.ts:9

  • [nitpick] The PR description refers to the controller as 'UmbItemDataApiRequestController', but the code uses 'UmbItemDataApiGetRequestController'. Consider aligning the naming for clarity.
import { UmbItemDataApiGetRequestController } from '@umbraco-cms/backoffice/entity-item';

@madsrasmussen madsrasmussen requested a review from nielslyngsoe May 5, 2025 17:55
@PeterKvayt
Copy link
Contributor

Are there any plans to add this fix into v15?

@nielslyngsoe
Copy link
Member

nielslyngsoe commented May 6, 2025

Hi @PeterKvayt, not currently, but maybe you can share your perspective for this? — It's also worth mentioning that we currently have no plans for v.15.5 — but are open to making v15.5 if there is a good case to cover.

Generally, v.16 is a small major, a few breaking changes regarding the front-end, but despite that, it should be an easy upgrade, so I hope you would consider going that direction?

Let me know where you stand, thanks in advance

@nielslyngsoe
Copy link
Member

@madsrasmussen code changes looks good to me, I have not tested it yet.

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

Successfully merging this pull request may close these issues.

3 participants