Unlock seamless workflows and faster delivery with our latest releases - Join the deep dive

Issue with keeping editors in current location when using initialValue template

5 replies
Last updated: Sep 18, 2024
Hello! Working from the studio, I wonder if there is a way to keep the editors in the current location when using an initiaValue template. Right now, it always takes the editor away from the list it has been used on.
Let me explain myself, we have in the desk structure an place for users to browse posts by categories, When from a term’s list, they hit the “New” button, we make sure the category is automatically assigned to the new post. But at the same time editors are taken to the “All Posts” area of the CMS, rather than remaining inside the current category of the “Posts by Category” area. I’m adding a video to make myself more clear.
Sep 16, 2024, 6:45 PM
In the
documentList
, have you defined a
schemaType
? I wonder if doing that helps.

https://www.sanity.io/docs/structure-builder-reference#schemaType-f8c40e825eef
Sep 17, 2024, 7:00 AM
It might be the case that when creating the document it doesn’t know in which list it belongs, so it defaults to the first known location in the hierarchy
Sep 17, 2024, 7:03 AM
Yes I have unfortunately. To no avail.
Sep 17, 2024, 8:08 PM
I was able to solve this by adding a
canHandleIntent
method before the intiialValueTemplate.
Sep 17, 2024, 8:26 PM
ah. good to know!
Sep 18, 2024, 6:45 AM

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?