diff --git a/framework/core/js/src/common/Application.tsx b/framework/core/js/src/common/Application.tsx index ecf917644..fe74c37b4 100644 --- a/framework/core/js/src/common/Application.tsx +++ b/framework/core/js/src/common/Application.tsx @@ -671,7 +671,7 @@ export default class Application { * @protected */ protected requestWasCrossOrigin(error: RequestError): boolean { - return new URL(error.options.url, document.baseURI).origin !== window.location.origin; + return new URL(error.options?.url, document.baseURI).origin !== window.location.origin; } protected requestErrorDefaultHandler(e: unknown, isDebug: boolean, formattedErrors: string[]): void { diff --git a/framework/core/js/src/common/Model.ts b/framework/core/js/src/common/Model.ts index 91dcc24b0..efb7d2617 100644 --- a/framework/core/js/src/common/Model.ts +++ b/framework/core/js/src/common/Model.ts @@ -192,7 +192,8 @@ export default abstract class Model { // If a 'relationships' key exists, extract it from the attributes hash and // set it on the top-level data object instead. We will be sending this data // object to the API for persistence. - if (attributes.relationships) { + // But only if the model does not actually have a real relationships attribute. + if (attributes.relationships && !('relationships' in this)) { data.relationships = {}; for (const key in attributes.relationships) { @@ -208,6 +209,8 @@ export default abstract class Model { delete attributes.relationships; } + console.log('data', data); + // Before we update the model's data, we should make a copy of the model's // old data so that we can revert back to it if something goes awry during // persistence.