Sha256: 7abc7a486468ea292843c371834a8294adabf444e4f660df8df970bd7ef4480b

Contents?: true

Size: 727 Bytes

Versions: 30

Compression:

Stored size: 727 Bytes

Contents

import { Controller } from "@hotwired/stimulus"
import { FetchRequest } from '@rails/request.js'

/*
  attach to a link element to have it request turbo stream responses

  <a href="/contacts" data-controller="refine--turbo-stream-link" data-action="refine--turbo-stream-link#get">Click me</a>

  Turbo is supposed to handle this natively with data-turbo-stream but we're
  seeing issues using that attribute inside iframes
*/
export default class extends Controller {
  async visit(event) {
    event.preventDefault()
    const request = new FetchRequest(
      (this.element.dataset.turboMethod || "GET"),
      this.element.href,
      {
        responseKind: "turbo-stream",
      }
    )
    await request.perform()
  }
}

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
refine-rails-2.12.0 app/javascript/controllers/refine/turbo-stream-link-controller.js
refine-rails-2.11.12 app/javascript/controllers/refine/turbo-stream-link-controller.js
refine-rails-2.11.11 app/javascript/controllers/refine/turbo-stream-link-controller.js
refine-rails-2.11.10 app/javascript/controllers/refine/turbo-stream-link-controller.js
refine-rails-2.11.9 app/javascript/controllers/refine/turbo-stream-link-controller.js
refine-rails-2.11.8 app/javascript/controllers/refine/turbo-stream-link-controller.js
refine-rails-2.11.6 app/javascript/controllers/refine/turbo-stream-link-controller.js
refine-rails-2.11.5 app/javascript/controllers/refine/turbo-stream-link-controller.js
refine-rails-2.11.4 app/javascript/controllers/refine/turbo-stream-link-controller.js
refine-rails-2.11.3 app/javascript/controllers/refine/turbo-stream-link-controller.js
refine-rails-2.11.2 app/javascript/controllers/refine/turbo-stream-link-controller.js
refine-rails-2.11.1 app/javascript/controllers/refine/turbo-stream-link-controller.js
refine-rails-2.11.0 app/javascript/controllers/refine/turbo-stream-link-controller.js
refine-rails-2.10.1 app/javascript/controllers/refine/turbo-stream-link-controller.js
refine-rails-2.10.0 app/javascript/controllers/refine/turbo-stream-link-controller.js
refine-rails-2.9.14 app/javascript/controllers/refine/turbo-stream-link-controller.js
refine-rails-2.9.13 app/javascript/controllers/refine/turbo-stream-link-controller.js
refine-rails-2.9.12 app/javascript/controllers/refine/turbo-stream-link-controller.js
refine-rails-2.9.11 app/javascript/controllers/refine/turbo-stream-link-controller.js
refine-rails-2.9.10 app/javascript/controllers/refine/turbo-stream-link-controller.js