hotwired / turbo

The speed of a single-page web application without having to write any JavaScript
https://turbo.hotwired.dev
MIT License
6.65k stars 421 forks source link

turbo:after-stream-render event #408

Closed dwightwatson closed 2 years ago

dwightwatson commented 2 years ago

We've got turbo:before-stream-render but it would also be helpful to have an event fire after the rendering has occurred as well.

My use-case is that the new DOM element is rendered into a scrollable window, so I'd like to scroll the new element into view after it's been rendered. It doesn't appear as though there is any event I can currently hook into that will let me perform this action after the DOM update has occurred.

seanpdoyle commented 2 years ago

Is this a duplicate of https://github.com/hotwired/turbo/issues/92 and https://discuss.hotwired.dev/t/event-to-know-a-turbo-stream-has-been-rendered/1554/6?

dwightwatson commented 2 years ago

Apologies, I did search but nothing came up.

woto commented 2 years ago

It helped me https://github.com/hotwired/turbo/pull/20#issue-773325276. Didn't found any drawbacks yet.