Watch a live product demo 👀 See how Sanity powers richer commerce experiences

Can String Type List be a Promise?

19 replies
Last updated: May 13, 2020
Can
string
type
list
be a promise?
May 13, 2020, 9:20 AM
Hi Toms, if I recall correctly async schemas are not supported yet, unfortunately. One workaround would be using a custom input component in this case, but that does involve some extra effort.
May 13, 2020, 9:32 AM
Now that's a concise description! Yeah, makes sense.
Got a little caught up that we define validations alongside the schema (IN THE SCHEMA FILE) that support Promises...
May 13, 2020, 9:40 AM
Concise but in need of elaboration? 😉
Indeed, Promises are supported in validation functions and a few other places. I can see how that is confusing. Hopefully we can expand support for them across the board soon AND improve our docs in the meantime, so you won’t have to find out by trial and error.
May 13, 2020, 9:46 AM
Never had seen the definition "async schemas are not supported".
May 13, 2020, 9:46 AM
Just that there's not a clear border within the schema files where it's actual schema and where those are studio-only enhancements.
May 13, 2020, 9:47 AM
But the notation of "async schemas are not supported" really answers whole lot more to me.
May 13, 2020, 9:47 AM
Thanks!
May 13, 2020, 9:48 AM
That’s because it’s nowhere right now, I think. Will draft up a ‘Gotcha’ on this to include in the docs. And don’t forget about the option to use a custom input component to achieve the above.
May 13, 2020, 9:55 AM
Yeah, I know about the option. The effort is tenfold though.
May 13, 2020, 9:56 AM
Absolutely. I might work on some recipes for these in the next two weeks to make this easier to just grab and run with.
May 13, 2020, 10:01 AM
I'm mentoring a project currently.Just doing the overall guidance not getting deep down into implementation.

So to speak, I'm puppet-master for now.
Am leading a team with 0 previous experience through an asteroid field of learning React, Next.js, Sanity and other tools along the way while working on a production project. I am doing the absolute practical minimum to get the ship going.

I can steer them, I do lessons in-between the PR's, provide resources, fill holes when they're ready etc.

But we're now only in React shenanigans. It doesn't pay off yet for them to start tinkering with the deep customization options of Sanity. Neither the client is paying for that atm.
May 13, 2020, 10:03 AM
So the effort isn't in the sense of actual implementation details, but in the scalability of where we're currently at with the project. 😉
May 13, 2020, 10:05 AM
Recipe is good, installable plugin would be awesome! (While I understand that it could shard the hell out of the Sanity landscape)
May 13, 2020, 10:05 AM
Whew, that sounds like an intense assignment if it also includes learning React for example - JS as well? 😄 Fun stuff. With regard to the latter, I’ll say this very quietly, but a plugin in this direction might be on its way indeed🤞
May 13, 2020, 10:28 AM
It does pack a transition from jQuery era of JS to this new React/webpack/babel era.
May 13, 2020, 10:35 AM
People were amazed by native promises, let alone async/await.
May 13, 2020, 10:36 AM
Spread operators, destructuring. const/let.
May 13, 2020, 10:36 AM
SSR/SSG... a whole new world for peeps over here! 🙂
But we're doing more than OK, I guess I have a knack for putting people on new tracks.
May 13, 2020, 10:43 AM
Not to take anything away from the peeps - they're good bunch of developers, just that they were stuck in the old days.
May 13, 2020, 10:43 AM

Sanity– build remarkable experiences at scale

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

Related answers

Get more help in the community Slack

TopicCategoriesFeaturedRepliesLast Updated
After adding the subtitle and running this code npm run graphql-deploy It does nothingSep 15, 2020
how to limit a reference to just one entry in Studio reference input side versus the default as-many-entries-as-you-fill-in-an-array...Sep 18, 2020
Is it possible to fetch more than one "_type" using GROQ?Nov 2, 2020
I want to add a view with the Structure builder (S.view.component) where I list similar documents based on the title. What...Sep 23, 2020
Is there a structure builder example where the format of each preview for the document list is modified?Feb 3, 2021
I have an array of references to a country schema type but it always just returns NULL values for meJan 30, 2021
Hi, I need help with a query for getting the url of an image asset. Here is what I've been trying, but I only get the _ref...Dec 1, 2020
Sanity UI looks brilliant :smiley: Is something like the current date picker possible at the moment? I’m not sure if anicon...Dec 21, 2020
Hey everyone. I have been coding and may have potentially accidentally deleted something. Does anyone know how to resolve...Dec 26, 2020
Hello everyone and happy new year :raised_hands::skin-tone-2:, I have a problem with outputting Portable Text :disappointed:...Jan 1, 2021

Related contributions

Clean Next.js + Sanity app
- Template

Official(made by Sanity team)

A clean example of Next.js with embedded Sanity ready for recomposition.

Cody Olsen
Go to Clean Next.js + Sanity app

Blog with Built-in Content Editing
- Template

Official(made by Sanity team)

A Sanity-powered blog with built-in content editing and instant previews.

Go to Blog with Built-in Content Editing