From ca9cf8e973a47ca46da7ab68b81ab06aae762e78 Mon Sep 17 00:00:00 2001 From: Tobias Pfeiffer Date: Sun, 10 Nov 2024 20:57:46 +0100 Subject: [PATCH] use proper dependent preloads (#451) --- lib/mindwendel/lanes.ex | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/lib/mindwendel/lanes.ex b/lib/mindwendel/lanes.ex index bb2c7ceb..3d50e3ef 100644 --- a/lib/mindwendel/lanes.ex +++ b/lib/mindwendel/lanes.ex @@ -102,16 +102,7 @@ defmodule Mindwendel.Lanes do lane_query |> Repo.all() - |> Repo.preload( - ideas: - ideas_advanced_query - |> preload([ - :link, - :likes, - :idea_labels, - :files - ]) - ) + |> Repo.preload(ideas: {ideas_advanced_query, [:link, :likes, :idea_labels, :files]}) end defp build_ideas_query_with_filter(%{filter_labels_ids: filter_labels_ids}) do @@ -128,7 +119,7 @@ defmodule Mindwendel.Lanes do end defp build_ideas_query_with_filter(%{} = _filters) do - Idea + from(idea in Idea) end @doc """