Reputation: 3032
I the top of my application template body I have:
<%= turbo_frame_tag :toasts %>
Which I use to display messages (https://github.com/excid3/tailwindcss-stimulus-components)
In my controllers I have an update_index patch route so that I can do some updates from the index page. The controller and corresponding turbo rendering works on the UI. In that update_index controller action I have this:
@project.broadcast_append_later_to @project, target: 'toasts', partial: 'shared/toast', locals: { user: current_user, type: :notice, message: "Project #{@project.name} Updated" }
In this action (for context is it matters this was the first model I added to my app). When I update via that action the toast is displayed as expected. The crazy part here is if I add this same logic to my other models the toast gets appended TWICE every-time.
Some context to perhaps trigger ideas:
This seems like a wild goosechase and looking for help - perhaps someone may be able to point me to something obvious I am missing here.
Upvotes: 1
Views: 1772