Comments (9)
This was fixed in v2.2.3 of Sanity!
from sanity-color-list.
Wow sorry for the lack of replies from my end on this, I seem to have somehow missed new notifications for this issue.
Thanks for the great work, @rexxars, I will try this out locally against the new studio version asap and update docs. :)
from sanity-color-list.
Thanks for letting me know! I'm a bit busy atm but will push an update when things clear up. If it's urgent all PR's are more than welcome :)
from sanity-color-list.
running into a issue with the required validation as well. would love to see this implemented 👍
update: cloned the repo and did a little digging this evening. seems like i was able to get the Rule.required()
validation to work correctly on fields using the colorlist input but cannot seem to figure out how to get rid of this little guy in the top right.
the error message updates to 'Required' as expected when the field is invalid, but keeps switching back to this default message whenever the field becomes valid. any insight @KimPaow ?
from sanity-color-list.
@arlenpeiffer Yeah I've noticed this issue too and tried to resolve it for some time now. It shows up when you nest the colorlist type. For example when you create a "colors" object type and then use that type instead of directly using the "colorlist" type. My best guess so far is that either there is a bug within the Studio itself with nested objects, or the data is not being saved correctly from my end. I'm trying to start a conversation with the Sanity team to figure out what's going on.
Version 1.2.1
does not have this issue so until resolved I would recommend you to use that version instead.
from sanity-color-list.
I've looked into this a bit and found the cause of the bug (it is a validation issue, not a data issue). Submitted a PR to fix the issue in Sanity: sanity-io/sanity#2247
from sanity-color-list.
So awesome! Thanks @rexxars!
from sanity-color-list.
This issue still seems to happen, when using the object notation for the value.
Only the option "Pink" from the example gives the validation error Value did not match any allowed values
.
{
title: "Color List",
description: "Pick a color",
name: "colors",
type: "colorlist", // required
options: {
list: [
{ title: "Yellow", value: "rgba(245, 199, 1, 0.5)" },
{ title: "Pink", value: {r: 246, g: 206, b: 219} }, // <--- This is the only one that is not accepted
{ title: "Red", value: "#f16d70" },
{ title: "Teal", value: "#88c6db" },
{ title: "Purple", value: "#aca0cc" },
{ title: "Green", value: "#bdcdcb" },
{ title: "White", value: "white" }
]
}
},
Might it be related to the Studio comparing the object against the derived string value?
from sanity-color-list.
This issue still seems to happen, when using the object notation for the value.
Good find. The schema is defined as value
being a string, which is why the validation fails. I think the object form should be removed from the readme, but I don't have access to this repo. @KimPaow ?
from sanity-color-list.
Related Issues (14)
- Label size HOT 3
- initialValue? HOT 1
- Show name and/or value next to RadioButton HOT 2
- initialValue is marked as invalid incorrectly when schema is composed into a different schema
- Visibility for very light colors HOT 2
- The option ‘borderradius outer’ has no effect HOT 1
- Studio v.3 compatibility HOT 14
- Crash when using validation HOT 4
- Deselecting colors HOT 3
- Doesn't work inside an array HOT 6
- Choose to return title as well (Feature request) HOT 3
- Can the list be generated? HOT 9
- Using within BlockContent results in unknown markdown type HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sanity-color-list.