Fix error on back after closing session (#769)

* Fix error on back after closing session

Clicking the browsers back button after closing a session
resulted in an error since it was trying to close an already closed notebook

* Overwrite back history on section delete
This commit is contained in:
Kevin 2021-12-08 13:17:50 +01:00 committed by GitHub
parent 3f86af051c
commit feb0ac214e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View file

@ -30,6 +30,6 @@ defmodule LivebookWeb.HomeLive.CloseSessionComponent do
@impl true
def handle_event("close", %{}, socket) do
Livebook.Session.close(socket.assigns.session.pid)
{:noreply, push_patch(socket, to: socket.assigns.return_to)}
{:noreply, push_patch(socket, to: socket.assigns.return_to, replace: true)}
end
end

View file

@ -44,6 +44,6 @@ defmodule LivebookWeb.SessionLive.DeleteSectionComponent do
delete_cells?
)
{:noreply, push_patch(socket, to: socket.assigns.return_to)}
{:noreply, push_patch(socket, to: socket.assigns.return_to, replace: true)}
end
end