Skip to content

Commit

Permalink
Only trigger turbo rendering when correct content type is returned
Browse files Browse the repository at this point in the history
  • Loading branch information
Klaus Zanders committed Jul 23, 2024
1 parent 0644dc8 commit 2bc91ed
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/components/primer/alpha/toggle_switch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ class ToggleSwitchElement extends HTMLElement {
throw new Error(await response.text())
}

if (window.Turbo && this.turbo) {
if (window.Turbo && this.turbo && response.headers.get('Content-Type') === 'text/vnd.turbo-stream.html') {
window.Turbo.renderStreamMessage(await response.text())
}
}
Expand Down

0 comments on commit 2bc91ed

Please sign in to comment.