-
-
Notifications
You must be signed in to change notification settings - Fork 313
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
[Turbo] Passing turbo_stream_listen
with components
#2147
Comments
Maybe you can pass "attendance" in your twig:Code element and call the turbo stream listen here ? To pass a stimulus attribute we would need to create another interface / twig function / tests / etc... I'm not sure this is a very common need, especially compared to the number of people who will help maintain / document / etc afterward :) But i'm ready to change my mind :) |
Yes, @smnandre, I can pass a "topic" prop and then conditionally call However, it feels wrong to me to "tie" my component to Turbo. It's similar to the way the Anyway, if this sounds like an odd request, feel free to close the issue! |
Nope, it's not odd, i get what you want here. The problem is that Turbo was implemented before the HTML Syntax, and its interface prevent to pass attributes like this... And i guess you don't want to wrap your content ? <twig:Code id="attendance">
<div {{ ...turbo_stream_listen("attendance") }}>
</div>
</twig:Code> |
Yes bu sometimes you cannot, depending on the css framework for example. Btw, no problem @smnandre this was just an input. Closing this issue! |
Right now
turbo_stream_listen
returns a string. TheStimulusAttributes
is casted to a string (it's actually a DTO withtoArray
function too).This make impossibile to use it with custom components because we can't pass a string representing the attribute set:
Is there any solution or workaround to pass the attribute set?
EDIT: I can only think to this to make it DRY. Any better solution?
The text was updated successfully, but these errors were encountered: