Skip to content

Commit

Permalink
fix: can't rely on this in onFulfilled when using confirmInvoke
Browse files Browse the repository at this point in the history
  • Loading branch information
ascott18 committed Feb 7, 2025
1 parent 263541c commit dcbe4c6
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
- Fix `ViewModel.$load` and `ListViewModel.$load` not properly working with `.useResponseCaching()`.
- Entities that own multiple one-to-one relationships should no longer throw errors when generating.
- Don't duplicate data source parameters in OpenAPI parameter collections.
- Fix error `this._removeFromParentCollection is not a function` thrown when calling `ViewModel.$delete.confirmInvoke()`.

# 5.3.1

Expand Down
2 changes: 1 addition & 1 deletion src/coalesce-vue/src/api-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ export const AxiosClient = axios.create();
AxiosClient.defaults.baseURL = "/api";
AxiosClient.defaults.paramsSerializer = (p) => objectToQueryString(p, false);

// Set X-Requested-With: XmlHttpRequest to prevent aspnetcore from serving HTML and redirects to API requests.
// Set X-Requested-With: XMLHttpRequest to prevent aspnetcore from serving HTML and redirects to API requests.
// https://github.com/dotnet/aspnetcore/blob/c440ebcf49badd49f0e2cdde1b0a74992af04158/src/Security/Authentication/Cookies/src/CookieAuthenticationEvents.cs#L107-L111
AxiosClient.interceptors.request.use((config) => {
const url = (config.baseURL ?? "") + (config.url ?? "");
Expand Down
4 changes: 2 additions & 2 deletions src/coalesce-vue/src/viewmodel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,7 @@ export abstract class ViewModel<
throw e;
}
})
.onFulfilled(function (this: ViewModel) {
.onFulfilled(() => {
if (!this.$save.result) {
// Can't do anything useful if the save returned no data.
return;
Expand Down Expand Up @@ -999,7 +999,7 @@ export abstract class ViewModel<
this._removeFromParentCollection();
}
})
.onFulfilled(function (this: ViewModel) {
.onFulfilled(() => {
this._removeFromParentCollection();
});

Expand Down

0 comments on commit dcbe4c6

Please sign in to comment.