Bug with accessing other fields in Sanity Studio 2.33 and difficulty downgrading versions.

11 replies
Last updated: Sep 12, 2022
Hello,
I’m not sure if there is a bug in Sanity Studio 2.33 or if i’m doing something wrong.

But in the past i used custom component, similar to the docs
https://www.sanity.io/docs/custom-input-widgets to display information based on the input to the document.
To access the other filds of this document i used props.parent and it works fine, but since the new version props.parent is undefined.

So is there a other way i should access the other fields of the document, or is this a bug of the new version?

Thanks
Sep 11, 2022, 8:41 AM
For some reason i’m also not able to go back of the version with the package.json file 😭 no matter if i run npm install or sanity install, it does not go back to the version in the package.json
Sep 11, 2022, 9:23 AM
ok i found out that i can also use
import { withDocument } from ‘part:@sanity/form-builder’;

to access other fields
Sep 11, 2022, 10:24 AM
That the way to do it! 💪 Wonderful you found this out by yourself, although documentation around this needs to be extended for sure. With the downgrading: which commands did you try in the cli?
Sep 11, 2022, 8:01 PM
Thanks, yes it was not easy to find resources about it.
For downgrading i tried a few things, but i thought it would just change in the package.json than run npm install, i think i also tried sanity install and i also downgraded the global cli.. but in the end i ended up, upgrading everything to the latest version again and found out about withDocument to solve my problem
Sep 11, 2022, 8:57 PM
If you want to install any a certain packageyour approach does not always work (if you don't delete node modules and the lock JSON) but using
npm install @sanity/cli^2.31.0
for example should
Sep 11, 2022, 9:01 PM
Yeah it was the right approach though. We are working on a broader set of docs in V3 though, so stay on the newest one and maybe have a look into our beta V3 docs ,😇
Sep 11, 2022, 9:02 PM
Yes i also tried with deleting package lock file and the node models folder, didn't also work. Not sure maybe i had also messed something up on my computer.
Sep 11, 2022, 9:05 PM
Well don't mess with it more if it works right now, I would say 😅😉
Sep 11, 2022, 9:23 PM
I prefer yarn for these kinds of reasons ... Seldomly encountered anything like that with yarn
Sep 11, 2022, 9:24 PM
And I fucked up my dependencies a lot of times by some dark magic and some ADHD late night bs
Sep 11, 2022, 9:24 PM
Lol
Sep 12, 2022, 4:26 AM

Sanity– build remarkable experiences at scale

The Sanity Composable Content Cloud is the 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?

Categorized in