Sha256: cc359ea22cb9d859794a28b2a2fea91e7ea3ddd2f14836e21e0106b6487e118a

Contents?: true

Size: 879 Bytes

Versions: 75

Compression:

Stored size: 879 Bytes

Contents

// Monkeypatch to fix turbo issue of wrong turbo-frame
// See: https://github.com/hotwired/turbo/pull/579
document.addEventListener("turbo:before-fetch-request", (event) => {
  const targetTurboFrame = event.target.getAttribute("data-turbo-frame");
  const fetchTurboFrame = event.detail.fetchOptions.headers["Turbo-Frame"];
  if (
    targetTurboFrame &&
    targetTurboFrame != fetchTurboFrame &&
    document.querySelector(`turbo-frame#${targetTurboFrame}`)
  ) {
    event.detail.fetchOptions.headers["Turbo-Frame"] = targetTurboFrame;
  }
});

// // Reload the entire page if we are missing a frame
// // See: https://stackoverflow.com/a/75704489/644571
// document.addEventListener("turbo:frame-missing", (event) => {
//   if (event.target.id != 'modal') return

//   const { detail: { response, visit } } = event;
//   event.preventDefault();
//   visit(response);
// });

Version data entries

75 entries across 75 versions & 1 rubygems

Version Path
plutonium-0.19.8 src/js/turbo/turbo_frame_monkey_patch.js
plutonium-0.19.7 src/js/turbo/turbo_frame_monkey_patch.js
plutonium-0.19.6 src/js/turbo/turbo_frame_monkey_patch.js
plutonium-0.19.5 src/js/turbo/turbo_frame_monkey_patch.js
plutonium-0.19.4 src/js/turbo/turbo_frame_monkey_patch.js
plutonium-0.19.3 src/js/turbo/turbo_frame_monkey_patch.js
plutonium-0.19.2 src/js/turbo/turbo_frame_monkey_patch.js
plutonium-0.19.1 src/js/turbo/turbo_frame_monkey_patch.js
plutonium-0.19.0 src/js/turbo/turbo_frame_monkey_patch.js
plutonium-0.18.8 src/js/turbo/turbo_frame_monkey_patch.js
plutonium-0.18.7 src/js/turbo/turbo_frame_monkey_patch.js
plutonium-0.18.6 src/js/turbo/turbo_frame_monkey_patch.js
plutonium-0.18.5 src/js/turbo/turbo_frame_monkey_patch.js
plutonium-0.18.4 src/js/turbo/turbo_frame_monkey_patch.js
plutonium-0.18.3 src/js/turbo/turbo_frame_monkey_patch.js
plutonium-0.18.2 src/js/turbo/turbo_frame_monkey_patch.js
plutonium-0.18.1 src/js/turbo/turbo_frame_monkey_patch.js
plutonium-0.18.0 src/js/turbo/turbo_frame_monkey_patch.js
plutonium-0.16.5 src/js/turbo/turbo_frame_monkey_patch.js
plutonium-0.16.4 src/js/turbo/turbo_frame_monkey_patch.js