You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
respond_to do |format|
if @offer.update(offer_params)
flash[:success] = "#{@offer.name} #{t(:updated)}"
format.js
else
format.js {render :edit}
end
end
Then in update.js.erb redirect is done with: Turbolinks.visit("<%= seller_offers_path %>");
As in this suggestion in session_store.rb I've set: Rails.application.config.session_store :cookie_store, key: 'myapp', expire_after: 1.day, httponly: { except: ['flash'] }
At the moment redirect after update is done, however no flash. If I remove Turbolinks.visit("<%= seller_offers_path %>"); then flash is shown, but I stay in same page as there is no redirect.
Is there a way to have flash on next page after redirect with Turbolinks, please?
My tech stack: Rails 6, unobtrusive_flash 3.3.1, Ruby 2.6.3
The text was updated successfully, but these errors were encountered:
This may be caused by turbo/turbolink replaced current page on flash show, this is the process:
request -> redirect with flash message -> show flash message but turbo/turbolink will replace current page immediately, so you wouldn't notice it.
You can find out this by remove UnobtrusiveFlash.showFlashFromCookies callback, and call UnobtrusiveFlash.showFlashFromCookies in chrome console after redirect.
You may solve this by show flash message after turbo/turbolink render
In my
update
action I haveThen in
update.js.erb
redirect is done with:Turbolinks.visit("<%= seller_offers_path %>");
In
application.js
there isAs in this suggestion in
session_store.rb
I've set:Rails.application.config.session_store :cookie_store, key: 'myapp', expire_after: 1.day, httponly: { except: ['flash'] }
At the moment redirect after update is done, however no flash. If I remove
Turbolinks.visit("<%= seller_offers_path %>");
then flash is shown, but I stay in same page as there is no redirect.Is there a way to have flash on next page after redirect with Turbolinks, please?
My tech stack: Rails 6, unobtrusive_flash 3.3.1, Ruby 2.6.3
The text was updated successfully, but these errors were encountered: