Issue with loading documents in a studio setup resolved by adding schemaType
8 replies
Last updated: Dec 24, 2021
L
I ran into an interesting issue. A studio setup that worked fine so far has stopped working.ProductPages are collected by type via the structure builder like so:
As mentioned this worked fine so far, but now clicking on one of the items results in an indefinite "Loading document..."
If I reenable collecting all the entries via
it again loads the document successfully.
Downgrading / upgrading seems to have not resolved the issue. I also logged out and in again via the CLI.
The dev tools don't provide any useful output besides a structure warning:
S.listItem() .title("Product Pages") .id("productPages") .icon(Icon) .child( S.documentTypeList("productPage") .title("Product Pages") .menuItems(S.documentTypeList("productPage").getMenuItems()) .filter("_type == $type") .params({ type: "productPage" }) .child((documentId) => S.document() .documentId(documentId) .views(Views({ type: "productPage" })) ) )
If I reenable collecting all the entries via
S.list() .title("Content") .items([ ...S.documentTypeListItems(), ])
Downgrading / upgrading seems to have not resolved the issue. I also logged out and in again via the CLI.
The dev tools don't provide any useful output besides a structure warning:
Structure warning: document type (schemaType) will be required for document nodes in the near future! At:
root > productPages > 82661311-f27a-44f1-88b0-bf756a78a28b"
Dec 24, 2021, 12:54 PM
P
Hi
user L
- happy holidays! In your custom views, could you try adding a schemaType? e.g.
.schemaType('productPage')
Dec 24, 2021, 1:06 PM
L
This indeed worked:
.child((documentId) => S.document() .documentId(documentId) .views(Views({ type: "productPage" })) .schemaType("productPage") )
Dec 24, 2021, 1:09 PM
L
This indeed worked:
.child((documentId) => S.document() .documentId(documentId) .views(Views({ type: "productPage" })) .schemaType("productPage") )
Dec 24, 2021, 1:09 PM
L
(
was part of the code earlier as well)
views(Views({ type: "productPage" }))
Dec 24, 2021, 1:10 PM
L
Thank you for the incredibly fast help
user M
! Much appreciated šDec 24, 2021, 1:11 PM
L
If this is reproducible across different setups, that could mean, that the warning message should possibly be adapted?
At the moment it doesn't suggest anything being broken and feels more like a deprecation warning.
At the moment it doesn't suggest anything being broken and feels more like a deprecation warning.
Dec 24, 2021, 1:12 PM
P
Glad to hear it's working! And I think you're spot on: the warning suggests it shouldn't break (yet). We'll look into fixing this. Thanks for the feedback š
Dec 24, 2021, 1:14 PM
L
Thanks again for helping and enjoy the holidays Peter! š š
Dec 24, 2021, 1:16 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.