-
Notifications
You must be signed in to change notification settings - Fork 436
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Treat [data-turbo-stream]
as boolean attribute
#630
Treat [data-turbo-stream]
as boolean attribute
#630
Conversation
@kevinmcconnell this is a follow-up to #612. If this ships, could you update hotwired/turbo-site#103 to reflect the boolean nature of the attribute? |
308035a
to
095992c
Compare
Looks good to me. Can you rebase? |
Replace equality checks for `[data-turbo-stream="true"]` with presence checks for `[data-turbo-stream]` to more closely match the canonical behavior for [boolean HTML attributes][]. Turbo already supports other boolean attributes like `[data-turbo-permanent]` and `[data-turbo-confirm]`, so `[data-turbo-stream]` should match the precedent. [boolean HTML attributes]: https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes#boolean_attributes
095992c
to
f9895d6
Compare
I want "data-turbo-stream" attribute in my form with POST to be "false", so it does not request turbo stream response, but still uses turbo (without page reload). Is it possible? |
In that case you can just omit the |
@evgenyneu I don't think that's possible right now, unfortunately. We don't have a way to opt out of stream responses for POST forms, as that's the default behaviour. Could you handle this on the server side instead, by not serving a turbo stream response for that case? |
@kevinmcconnell, do we want ability to opt out of turbo streams for POST forms? If yes I can create a PR, so we can use
Thanks, good idea, I can add a "no-turbo-stream" parameter to my form, and on server side render a standard |
It sounds like a good idea to me. I've not personally run into a situation where I needed this, but I could see how it could be useful.
It will, but there's a little more to it, too. The default behaviour is to accept stream responses for
What do you think? Or did you have another way in mind? If you want to make a PR to solve it, I'd be happy to review when it's ready. |
@kevinmcconnell sounds like a good plan, I'll make a PR. What's the purpose of the |
I don't think you'd actually need to set |
@evgenyneu any updates on that PR? I'm interested in the same feature and wondering if I should work on that. |
@MatheusRich no sorry I gradually became disinterested in it for some reason :D |
Replace equality checks for
[data-turbo-stream="true"]
with presencechecks for
[data-turbo-stream]
to more closely match the canonicalbehavior for boolean HTML attributes.
Turbo already supports other boolean attributes like
[data-turbo-permanent]
and[data-turbo-confirm]
, so[data-turbo-stream]
should match the precedent.