Skip to content

Commit cffc046

Browse files
committed
LiveComponent: Prevent Error Rendering on JSON Response
1 parent 306ad93 commit cffc046

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/LiveComponent/assets/dist/live_controller.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2014,7 +2014,7 @@ var Component = class {
20142014
const controls = { displayError: true };
20152015
this.valueStore.pushPendingPropsBackToDirty();
20162016
this.hooks.triggerHook("response:error", backendResponse, controls);
2017-
if (controls.displayError) {
2017+
if (controls.displayError && !headers.get("Content-Type")?.includes("application/json")) {
20182018
this.renderError(html);
20192019
}
20202020
this.backendRequest = null;

src/LiveComponent/assets/src/Component/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ export default class Component {
317317
this.valueStore.pushPendingPropsBackToDirty();
318318
this.hooks.triggerHook('response:error', backendResponse, controls);
319319

320-
if (controls.displayError) {
320+
if (controls.displayError && !headers.get('Content-Type')?.includes('application/json')) {
321321
this.renderError(html);
322322
}
323323

0 commit comments

Comments
 (0)