diff --git a/lib/livebook_web/live/session_live/persistence_component.ex b/lib/livebook_web/live/session_live/persistence_component.ex index a1a835d9a..fa3bd65c5 100644 --- a/lib/livebook_web/live/session_live/persistence_component.ex +++ b/lib/livebook_web/live/session_live/persistence_component.ex @@ -52,7 +52,12 @@ defmodule LivebookWeb.SessionLive.PersistenceComponent do |> assign_new(:attrs, fn -> attrs end) |> assign_new(:new_attrs, fn -> attrs end) |> assign_new(:draft_file, fn -> - file || Livebook.Config.local_file_system_home() + file || + case assigns.session.origin do + # If it's a forked notebook, default to the same folder + {:file, file} -> FileSystem.File.containing_dir(file) + _ -> Livebook.Config.local_file_system_home() + end end) |> assign_new(:saved_file, fn -> file end)