You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We're seeing a weird issue with calling Ash.load to load relationships on already-loaded data. It seems to unload other calculations on related data, which definitely shouldn't happen?
To Reproduce
I've tried to pare down these resources as much as possible - ping me if they don't make sense anymore.
defmoduleMyApp.OrgOpportunitydorelationshipsdobelongs_to:org,MyApp.Org,allow_nil?: falsebelongs_to:opportunity,MyApp.Opportunity,allow_nil?: falseendenddefmoduleMyApp.Opportunitydorelationshipsdobelongs_to:google_place,Google.Place,allow_nil?: falseendcalculationsdo# I tried making this an aggregate instead, no differencecalculate:google_review_score,:float,expr(google_place.review_score)endend
Because we want to do this to reload a subset of related data (instead of reloading the whole resource and all of its related data), the only way I can think of to get this to work is to specifically unload the relationship and then load it again with lazy?: true so nothing else is affected, that seems to work.
eg.
iex> # If org was already loaded on the OrgOpportunity record
iex> oo2 = Ash.Resource.unload(oo, :org, actor: user)
iex> Ash.load!(oo2, :org, actor: user, lazy?: true)
iex> # This would preserve other data like google_review_score on the related opportunity
But I don't think I should need to do this?
Expected behavior
I wouldn't expect the google_review_score to be unloaded when loading something else.
Runtime
Elixir version 1.18.2-otp-27
Erlang version 27.2
OS macOS Sonoma
Ash version 3.4.65
The text was updated successfully, but these errors were encountered:
Describe the bug
We're seeing a weird issue with calling
Ash.load
to load relationships on already-loaded data. It seems to unload other calculations on related data, which definitely shouldn't happen?To Reproduce
I've tried to pare down these resources as much as possible - ping me if they don't make sense anymore.
Because we want to do this to reload a subset of related data (instead of reloading the whole resource and all of its related data), the only way I can think of to get this to work is to specifically unload the relationship and then load it again with
lazy?: true
so nothing else is affected, that seems to work.eg.
But I don't think I should need to do this?
Expected behavior
I wouldn't expect the
google_review_score
to be unloaded when loading something else.Runtime
The text was updated successfully, but these errors were encountered: