V16: Replace legacy/fetch with @hey-api/client-fetch#19002
Merged
iOvergaard merged 65 commits intov16/devfrom Apr 14, 2025
Merged
V16: Replace legacy/fetch with @hey-api/client-fetch#19002iOvergaard merged 65 commits intov16/devfrom
legacy/fetch with @hey-api/client-fetch#19002iOvergaard merged 65 commits intov16/devfrom
Conversation
… api with @hey-api/client-fetch
…pport @hey-api/client-fetch) or the given type if the response does not contain a 'data' object
… an optional error object
Contributor
There was a problem hiding this comment.
Copilot reviewed 223 out of 225 changed files in this pull request and generated no comments.
Files not reviewed (2)
- src/Umbraco.Web.UI.Client/package-lock.json: Language not supported
- src/Umbraco.Web.UI.Client/package.json: Language not supported
…to avoid imports from core
|
Azure Static Web Apps: Your stage site is ready! Visit it here: https://victorious-ground-017b08103-19002.westeurope.6.azurestaticapps.net |
leekelleher
approved these changes
Apr 14, 2025
Member
leekelleher
left a comment
There was a problem hiding this comment.
Tested out, working as expected. I'm happy with the code changes. 🚀
|
Azure Static Web Apps: Your stage site is ready! Visit it here: https://victorious-ground-017b08103-19002.westeurope.6.azurestaticapps.net |
|
Azure Static Web Apps: Your stage site is ready! Visit it here: https://victorious-ground-017b08103-19002.westeurope.6.azurestaticapps.net |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This pull request includes several changes to the
Umbraco.Web.UI.Clientproject, focusing on refactoring the backend API integration and updating dependencies. The most important changes include modifying thepackage.jsonandpackage-lock.jsonfiles, updating the API client configuration, and replacing the HTTP client with @hey-api/client-fetch.The reason for the many file changes is that the profile of the generated SDKs have changed moving from legacy/fetch to @hey-api/client-fetch in that we now have to supply each part of a call in their respective parts, i.e.
body,path, andqueryare now separate objects.Breaking Changes
HTTP Client
The global object OpenAPI imported from
@umbraco-cms/backoffice/external/backend-apiis replaced with a new HTTP client, which is used like this:The client is generated using @hey-api/client-fetch and can be used as a stand-in for other generated @hey-api SDKs, meaning you can use it when connecting to your controllers. The client comes equipped with authentication and error handling, and will eventually support retrying requests after successful login.
Another great feature is that the client can be used directly to make HTTP requests without having an SDK (generated factory functions):
Note
Read more about @hey-api/fetch-client on their website
tryExecuteAndNotify
The utility
tryExecuteAndNotifyhas been deprecated in favor of using the basetryExecutefunction, which now supports showing error notifications. See #18939 for more details.tryExecute
tryExecuteAndNotify#18939 for more details.UmbApiResponse<T = unknown> = T & UmbApiErrorResponsetype, which in essence means that thedataproperty is not guaranteed. Instead, it will return exactly the promise return type that was given to it with an addederrorproperty. In cases where a @hey-api SDK was used, you will get the data in adataproperty anyway. This is done to ensure that tryExecute does not return a nesteddata.dataobject and gives a cleaner model.UmbDataSourceResponselives. Instead, this type is now exclusively used for data sources.Tree repositories
To comply with the usage of
UmbDataSourceResponse, some base interfaces for tree repositories now require this model. This makes it easier to map directly from an API model into a data source.Other changes
Dependency Updates and Configuration Changes:
src/Umbraco.Web.UI.Client/package.json: Addedhttp-clientand updated the path forbackend-api.API Client Refactoring:
src/Umbraco.Web.UI.Client/src/apps/app/app.element.ts: ReplacedOpenAPIwithumbHttpClientfor server URL and authentication token configuration. [1] [2] [3] [4] [5]