🔮 Sanity Create is here. Writing is reinvented. Try now, no developer setup

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
parent
prop being returned from
hidden
is totally
undefined
all 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
hidden
property 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
value
prop is now taking the ENTIRE object value, not the actual field value?
May 22, 2023, 8:41 PM
For context: this is for the
graphicAspectRatio
field, so the
value
property SHOULD only equal
"custom"
, but instead it's getting the entire parent object's field values, and
parent
is 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
user A
/
user M
any chance you know what's up? I've never seen this before☝️
May 22, 2023, 8:47 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.
May 22, 2023, 9:00 PM
sorry
user M
, but it's not our code
May 22, 2023, 9:00 PM
it's not showing up locally or on deployed studios for our project
May 22, 2023, 9:00 PM
this studio has been deployed for weeks
May 22, 2023, 9:01 PM
and these fields have not changed
May 22, 2023, 9:01 PM
(projectId:
3yki7x9c
, dataset:
production
)
May 22, 2023, 9:02 PM
if you check the screenshot farther up the thread, you can see something is wrong... the
value
prop 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
fieldset
to 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
fieldset
and
hidden
attribute.
May 22, 2023, 9:32 PM
Can you share the code for the field that’s behaving this way?
May 22, 2023, 9:32 PM
yup one sec!
May 22, 2023, 9:32 PM
full object schema as well ☝️
May 22, 2023, 9:33 PM
Hmm, it looks like it’s still working on my end. I’ll keep exploring, though.
May 22, 2023, 9:48 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?

    {
      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
(and tbh I didn't even know that was possible 😅)
May 22, 2023, 10:16 PM
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
user A
I logged it in shortcut yesterday and alerted the Studio team.
May 23, 2023, 3:24 PM
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
Let me check!
May 24, 2023, 4:12 PM
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
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
This is great! Thank you!
Jun 6, 2023, 3:23 PM
All good, thank you fam! 🙌
Jun 6, 2023, 3:32 PM
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.

Was this answer helpful?