Giter VIP home page Giter VIP logo

Comments (9)

rexxars avatar rexxars commented on July 20, 2024 1

This was fixed in v2.2.3 of Sanity!

from sanity-color-list.

KimPaow avatar KimPaow commented on July 20, 2024 1

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.

KimPaow avatar KimPaow commented on July 20, 2024

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.

arlenpeiffer avatar arlenpeiffer commented on July 20, 2024

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.
Screen Shot 2020-12-28 at 10 49 31 PM
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.

KimPaow avatar KimPaow commented on July 20, 2024

@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.

rexxars avatar rexxars commented on July 20, 2024

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.

arlenpeiffer avatar arlenpeiffer commented on July 20, 2024

So awesome! Thanks @rexxars!

from sanity-color-list.

rennehir avatar rennehir commented on July 20, 2024

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.

rexxars avatar rexxars commented on July 20, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.