When I add a new model to my database, I want to add it to a table as a table row and sort the table on the frontend side.
I can append the element without problems (create.turbo_stream.erb):
<%=
turbo_stream.append(
'my-table-id',
partial: 'table_row',
locals: {
model: @my_model
})
%>
I am listening to the “turbo:submit-end” event to sort the table rows but I cannot access the row corresponding to the new model inserted, just the old ones.
Do we have another event that is fired as soon as the form submission ends AND the page was modified (in this case, "turbo_stream.append"ed) ? If not, is it possible to do it with “turbo:submit-end” ?