JS not invoked in Turbo-Frame

Hello,

I was wondering, why tags, which were loaded in a turbo-frame arent evaluated.
It seems that the script elements are lost in activateElement(), when cloning the retrieved frame:
element = document.importNode(element, true);

I wanted to render a ReactOnRails component in the frame. The gem solved that using those script tags.

Did nobody encounter such an issue yet?

Or does anybody have an idea how I could work around this issue?

Thanks alot!

Are you referring to <script> tags or all HTML tags?

If script tags, see: Evaluate script tags from turbo streams · Issue #186 · hotwired/turbo · GitHub

Hi, I’m referring script tags. Thanks for the issue. It seems to got accepted (regarding turbo-streams) and also refer to #192, which might solve especially my problem (for turbo-frame).

What chances do I have to speed the merge of PR up ? :wink:

No idea, but you can try the gist referred to in the ticket if you can’t wait for it to be merged.

2 Likes