FEATURE: Improvement to history stack handling on server errors

The exception page is shown before Ember can actually figure out what the final destination URL we're going to is.
This means that the new page is not present in the history stack, so if we attempt to use the history stack to go back, we will actually navigate back by two steps.
By instead forcing a navigation to the current URL, we achieve the goal of going "back" with no history mucking.

Unfortunately, the actual URL that was attempted is not available. Additionally, this only works for the on-screen back button and not the browser back.

Additionally, several modernizations of the exception page code were made.
This commit is contained in:
Kane York
2021-06-14 15:22:51 -07:00
committed by Kane York
parent f25c55b5be
commit c72bf1d732
5 changed files with 57 additions and 34 deletions

View File

@ -299,7 +299,7 @@ class ApplicationController < ActionController::Base
with_resolved_locale(check_current_user: false) do
# Include error in HTML format for topics#show.
if (request.params[:controller] == 'topics' && request.params[:action] == 'show') || (request.params[:controller] == 'categories' && request.params[:action] == 'find_by_slug')
opts[:extras] = { html: build_not_found_page(error_page_opts) }
opts[:extras] = { html: build_not_found_page(error_page_opts), group: error_page_opts[:group] }
end
end