Fix bug with non-teams app specs

This commit is contained in:
Alexandre de Souza 2025-11-07 10:33:05 -03:00
parent edcc1d48b7
commit bc4857a72f
No known key found for this signature in database
GPG key ID: E39228FFBA346545
2 changed files with 12 additions and 5 deletions

View file

@ -185,10 +185,14 @@ defmodule Livebook.Apps.Manager do
reduce: {state, [], false} do reduce: {state, [], false} do
{state, up_to_date_app_specs, schedule_sync?} -> {state, up_to_date_app_specs, schedule_sync?} ->
case fetch_app(app_spec.slug) do case fetch_app(app_spec.slug) do
{:ok, _state, app} {:ok, _state, app} when app.app_spec.version == app_spec.version ->
when app.app_spec.version == app_spec.version and if changed_app_folder?(app.app_spec, app_spec) do
app.app_spec.app_folder_id == app_spec.app_folder_id -> ref = redeploy(app, app_spec)
{state, [app_spec | up_to_date_app_specs], schedule_sync?} state = track_deployment(state, app_spec, ref)
{state, up_to_date_app_specs, schedule_sync?}
else
{state, [app_spec | up_to_date_app_specs], schedule_sync?}
end
{:ok, :reachable, app} -> {:ok, :reachable, app} ->
ref = redeploy(app, app_spec) ref = redeploy(app, app_spec)
@ -340,4 +344,7 @@ defmodule Livebook.Apps.Manager do
deployment.ref == ref && deployment deployment.ref == ref && deployment
end) end)
end end
defp changed_app_folder?(%{app_folder_id: id}, %{app_folder_id: id2}), do: id != id2
defp changed_app_folder?(_, _), do: false
end end

View file

@ -257,7 +257,7 @@ defmodule LivebookWeb.AppsLive do
grouped_apps = grouped_apps =
filtered_apps filtered_apps
|> Enum.group_by(& &1.app_spec.app_folder_id) |> Enum.group_by(&get_in(&1.app_spec.app_folder_id))
|> Enum.map(fn |> Enum.map(fn
{nil, apps} -> {nil, apps} ->
{"Ungrouped apps", "ungrouped-apps", "asterisk", apps} {"Ungrouped apps", "ungrouped-apps", "asterisk", apps}