Closed arturoalviar closed 3 years ago
Hi @arturoalviar ,
thanks for reporting :)
tbh, i haven't tested this use case 🙈 but the suggested changes seems good to me.
If you want, feel free to create a PR with the changes.
Thanks!
Regards, Marcus
I have create the PR. If it is merged, I can also update the documentation if necessary. Thanks for this great plugin!
Hi @arturoalviar ,
i have merged the changes and will publish it soon.
If you have the time to update the documentation, here the link to the files: https://github.com/noxify/webstone.info/tree/master/content/documentation/gridsome-plugin-remote-image
I think it's just the configuration.md
and the example-sanity.md
.
Thanks!
Regards, Marcus
Version 1.3.0 with your changes is now available :)
Thank you for updating the plugin! I also updated the documentation and created a PR. Thanks again.
Thanks for your contribution. Docu changes are merged.
Description
I am working on a Gridsome Sanity starter that uses this plugin but when I use it with a fresh Sanity studio that has no images, the
fieldType
in thecreateSchema
function returnsfalse
since the SanityImageAsset collection is empty. This is problematic since a number of my queries uselocalFile
as typeImage
rather than[Image]
. Here is a portion of the page query used in my Index.vue file.Environment
Expected result
For
localFile
to be of typeImage
not[Images]
when SanityImageAsset collection is empty, specifically when a Sanity Studio has been created and no images have been uploaded.Actual result
Since the collection is empty, the
node
value in thegetFieldType
function isnull
and thus returnsfalse
. Because of this, theschemaType
in thegenerateSchemaType
becomes[Images]
rather thanImage
.This is the error displayed:
My current solution
I did the following so my starter could query
localFile
when theallSanityImageAsset
collection is emptyWould it make sense to allow the user to configure the schemaType? Or is there a better solution to handling an empty collection?