Collectionlink returns string if empty instead of empty array

How to fix collectionlink? returns empty string if empty instead of empty array!!! It’s drive me crazy!!! Why it’s happen??? Why different types??? Plz help!!!

On which version did you encounter this issue?
I was not able to reproduce your result with "" empty string on the latest version - but I see a similar effect with null instead.

Testing on 0.12.1 shows the following result:

linkcollection / linkcollectionselect

  1. with {multiple: true} - 3 states
  • null - if there was never a link set for this entry+field
  • [] - empty array if at least 1 link was once set set but meanwhile reset/removed again
  • [{LINK_OBJ},...] - array of link objects if links are set
  1. with {multiple: false} - 2 states
  • null - if there is currently no link set yet / link was reset/removed
  • {LINK_OBJ} - link object if a link is set

Bug or feature

So one could argue it’s a bug to show

  • an empty array [] when multi-links were reset
  • but null if there were never any links set

One could also argue it’s a feature to know if there is no-value-yet vs no-value-anymore.

:rofl:
I think we should go with a Feature Request to have the same output null or [] :wink:
Thinks like that are frustrating when you have to figure it in FE