Skip to content

Commit 632a95d

Browse files
committed
fix: don't add the resource's primary table if there are no polymorphic tables
1 parent 4fc2848 commit 632a95d

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

lib/ash_admin/resource/resource.ex

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -276,15 +276,19 @@ defmodule AshAdmin.Resource do
276276
|> Enum.filter(&(&1.destination == resource))
277277
|> Enum.map(& &1.context[:data_layer][:table])
278278
|> Enum.uniq()
279-
|> then(
280-
&Enum.concat(
281-
[
282-
Spark.Dsl.Extension.get_opt(resource, [:postgres], :table),
283-
Spark.Dsl.Extension.get_opt(resource, [:sqlite], :table)
284-
],
285-
&1
286-
)
287-
)
279+
|> case do
280+
[] ->
281+
[]
282+
283+
tables ->
284+
Enum.concat(
285+
[
286+
Spark.Dsl.Extension.get_opt(resource, [:postgres], :table),
287+
Spark.Dsl.Extension.get_opt(resource, [:sqlite], :table)
288+
],
289+
tables
290+
)
291+
end
288292
|> Enum.reject(&is_nil/1)
289293
end
290294

0 commit comments

Comments
 (0)