class ApplicationController < ActionController::Base # Only allow modern browsers supporting webp images, web push, badges, import maps, CSS nesting, and CSS :has. allow_browser versions: :modern def render_stream(notice: nil, alert: nil, &) flash.now[:notice] = notice if notice flash.now[:alert] = alert if alert streams = [] streams << turbo_stream.replace(:flash, partial: 'layouts/components/flash') if flash.any? # TODO: turbo_stream_elements which stores any append, prepend, replace, update, remove, before, after or refresh actions if block_given? yields = yield(turbo_stream) if yields.is_a? Array streams += yields else streams << yields end end render turbo_stream: streams end end