From 60c96c7a1d09f36abcec37429cb54ba9d3d49d84 Mon Sep 17 00:00:00 2001 From: Zach Daniel Date: Mon, 3 Jul 2023 12:23:35 -0400 Subject: [PATCH] fix: don't loan unless we need to for runtime filters --- lib/ash/filter/runtime.ex | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/ash/filter/runtime.ex b/lib/ash/filter/runtime.ex index 38cb1207..306c29fa 100644 --- a/lib/ash/filter/runtime.ex +++ b/lib/ash/filter/runtime.ex @@ -56,7 +56,14 @@ defmodule Ash.Filter.Runtime do |> Enum.filter(& &1) |> Enum.reject(&Ash.Resource.loaded?(records, &1)) - records = api.load!(records, refs_to_load) + records = + case refs_to_load do + [] -> + records + + refs_to_load -> + api.load!(records, refs_to_load) + end filter |> Ash.Filter.relationship_paths(true)