Issue with the `hidden` property returning undefined for the `parent` prop in a fieldset in Sanity Studio.
38 replies
Last updated: Jun 6, 2023
URGENT: Our
parentprop being returned from
hiddenis totally
undefinedall of a sudden on production...
May 22, 2023, 8:36 PM
This is happening everywhere in our schema, out of nowhere on production builds of a client studio.
May 22, 2023, 8:37 PM
No idea what is going on, but this is 1000% not a user error. Did something change with what data is returned in the
hiddenproperty for fields in V3?
May 22, 2023, 8:37 PM
Can confirm this is a field in an object... this should absolutely be coming through with data according to the docs
May 22, 2023, 8:41 PM
yet, it looks like the
valueprop is now taking the ENTIRE object value, not the actual field value?
May 22, 2023, 8:41 PM
For context: this is for the
graphicAspectRatiofield, so the
valueproperty SHOULD only equal
"custom", but instead it's getting the entire parent object's field values, and
parentis undefined.
May 22, 2023, 8:42 PM
Again, no changes were made on our end, the client just started reporting the studio crashing (since I wasn't optionally chaining the
parent.[field]). We're on the latest version of v3 btw!
May 22, 2023, 8:43 PM
Please don’t tag team members that aren’t already involved in a thread.
This looks like something particular to your code. The parent prop is showing up both locally and on deployed Studios on my end.
This looks like something particular to your code. The parent prop is showing up both locally and on deployed Studios on my end.
May 22, 2023, 9:00 PM
if you check the screenshot farther up the thread, you can see something is wrong... the
valueprop is returning the entire object instead of the specific field value this is defined in.
May 22, 2023, 9:04 PM
Definitely not something with our code, considering that and the fact that we have had this setup live and working for weeks.
May 22, 2023, 9:05 PM
Actually
user M
I have narrowed it down, it seems to only behave this way the moment you attach a fieldsetto a conditional field...
May 22, 2023, 9:31 PM
this definitely used to not be the case, so it sounds like there's a degredation with fields that use a
fieldsetand
hiddenattribute.
May 22, 2023, 9:32 PM
Ok, I was able to replicate. I don’t know if they knowingly changed the behavior. Did you update the version of the Studio today or did it come up out of the blue entirely?
Until we track it down, can you move the conditional to the fieldset itself to get around it?
Until we track it down, can you move the conditional to the fieldset itself to get around it?
{ title: 'Custom Aspect Ratio', name: 'aspectRatio', options: {columns: 2}, hidden: ({ parent }) => parent?.graphicAspectRatio !== 'custom', },
May 22, 2023, 10:08 PM
I did not update the studio version today, so it does seem to have come up out of the blue!
May 22, 2023, 10:14 PM
Wait, it seems like it suddenly is working normally again for me. I don’t know what’s happening but I’ll get this logged so that the DX Studio team can start triaging.
May 22, 2023, 10:15 PM
sounds good, yea I was just going to say I tried to add this to the fieldset itself, but no dice
May 22, 2023, 10:15 PM
E
Hi
user J
long time - did it get sorted?May 23, 2023, 10:16 AM
hey there
user A
! Not yet, it sounds like it was getting logged for the DX team to look at?May 23, 2023, 3:23 PM
E
Just out of curiousity - did this happen with an upgrade
user J
- or just out of the blue?May 23, 2023, 8:01 PM
Hey there
user M
! Just curious if there was any movement on this one by chance?May 24, 2023, 4:11 PM
D
Hey everyone! Got the same problem after updating to 3.11.5. Is there any success in resolving that?
Jun 5, 2023, 8:27 AM
I haven't heard any movement on this, would love to know when this will be prioritized, since it's a pretty glaring issue for a pretty generic setup 😕
Jun 5, 2023, 4:37 PM
E
Thanks for chasing
user J
and apologies for this taking time to make it to the top of the list. Fix is out in latest release.Jun 6, 2023, 3:21 PM
D
This is great! Thank you!
Jun 6, 2023, 3:23 PM
J
Wow just ran into this myself. And there's a fix out. Hooray! 🙏
Jun 6, 2023, 8:05 PM
Sanity– build remarkable experiences at scale
Sanity is a modern headless CMS that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.