app/javascript/kpop/turbo_actions.js in katalyst-kpop-3.0.0.beta.3 vs app/javascript/kpop/turbo_actions.js in katalyst-kpop-3.0.0.beta.4

- old
+ new

@@ -1,7 +1,9 @@ import { Turbo } from "@hotwired/turbo-rails"; +import DEBUG from "./debug"; + import { StreamModal } from "./modals/stream_modal"; import { StreamRenderer } from "./utils/stream_renderer"; function kpop(action) { return action.targetElements[0]?.kpop; @@ -22,11 +24,19 @@ kpop(this)?.dismiss({ reason: "turbo_stream.kpop.dismiss" }); }; Turbo.StreamActions.kpop_redirect_to = function () { if (this.dataset.turboFrame === this.target) { - this.targetElements[0].src = this.getAttribute("href"); + if (DEBUG) + console.debug( + `kpop: redirecting ${this.target} to ${this.getAttribute("href")}` + ); + const a = document.createElement("A"); + a.setAttribute("data-turbo-action", "replace"); + this.targetElements[0].delegate.navigateFrame(a, this.getAttribute("href")); } else { + if (DEBUG) + console.debug(`kpop: redirecting to ${this.getAttribute("href")}`); Turbo.visit(this.getAttribute("href"), { action: this.dataset.turboAction, }); } };