Updating attributes on lazy-loaded turbo-frame

Hi,

On my page, I have a lazy-loaded turbo-frame with a custom attribute, something like:

<turbo-frame id="frame_1" data-sort-code=0 src="/data/1">
   ...
</turbo-frame>

The server returns a response with the corresponding frame, but with a different attribute value

<turbo-frame id="frame_1" data-sort-code=20>
   ...
</turbo-frame>

As a result, I see that the contents of the turbo frame are updated, but not the attribute – the value remains 0. Is there a way to easily update the attributes based on the turbo frame response?

I might have found the answer in the turbo docs actually:

In practice, a <turbo-frame> element’s contents are rendered as if they operated on by <turbo-stream action="update"> element.

I will try writing some custom render code to get more of a “replace” element.