f3-cortex icon indicating copy to clipboard operation
f3-cortex copied to clipboard

empty relation shouldn't be treated as null

Open olaulau opened this issue 1 year ago • 1 comments

when retrieving a relation which return zero element, cortex gives null instead of a CortexCollection. this is confusing, and forces us to tread those cases with custom code :

  • if I remove one element from the relation, I can come to zero element, and have to convert my empty collection to null before save
  • if the relation I get is null, I have to create a collection before adding an element to it any technical reason for this ? thanks.

olaulau avatar Jan 25 '24 17:01 olaulau

If i can recall correctly, it was simply because of convenient usage in templates, like <F3:check if="{{ @user.files }}"> and so one. Having returned an empty collection would allow this condition to pass.

ikkez avatar Jan 30 '24 09:01 ikkez