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
I often find myself having a field that is optional and wanting to set data on that field. But to do that I first need to check if that field exists and for that I currently convert the node to a view() and then I check if it exists before initializing the field. See this example:
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I often find myself having a field that is optional and wanting to set data on that field. But to do that I first need to check if that field exists and for that I currently convert the node to a
view()
and then I check if it exists before initializing the field. See this example:It would be great if there was a
has()
operation on theObjApi
. Another idea could be maybe to have something like anupsert()
operation:Option 1:
Option 2:
Option 2 would already fail when trying to access the prop with
.arr("children")
so it would need to be a different API.Beta Was this translation helpful? Give feedback.
All reactions