Coder Social home page Coder Social logo

Comments (6)

Aidurber avatar Aidurber commented on August 12, 2024

This is because Picky maintains an internal state, it's more trouble than it's worth. I'm going to work on a major release making Picky a controlled component only, I can't think of any value it provides being an uncontrolled component, and it causes bugs like this when props and state get out of sync.

from react-picky.

karankumar89 avatar karankumar89 commented on August 12, 2024

Yea I observed this too and i did make a hack fix (I can share it here, if you guys want it) for this but i cant solve it for SELECT ALL case
-> When you do a select all in one picky and then update the state from the outside
-> Lets assume only 4 out of 10 elements are now selected
-> IF you try to select 5th element, all the elements get selected.

Anyways thats awesome if you releasing a controlled component only one.

from react-picky.

Aidurber avatar Aidurber commented on August 12, 2024

@karankumar89 @arun567

I think I get what you mean. Though it might be an issue with your state, not Picky. If you're modifying the value externally, that state is the single source of truth for Picky.

See: https://codesandbox.io/s/747z71zpxj

I check to see if the item exists before adding it.

If I'm not quite on the same wavelength as you two, can you provide a simple CodeSandbox so I can investigate?

Thanks :)

from react-picky.

karankumar89 avatar karankumar89 commented on August 12, 2024

@Aidurber Yea you're on the same track but mine was a different use case. I retried the steps and i think its been fixed in the v4.0.1. The steps to reproduce is-

  • Select All Elements
  • Click on Add Button (only item3 and item4 are selected)
  • Select options that are not selected (ex: item 5)
  • v3.0.2 all elements get selected instead of just one (item 5)

v4.0.1

https://codesandbox.io/s/j4j0j933lv

v.3.0.2

https://codesandbox.io/s/w6yp3x159l

Thanks for looking into this 🎉

from react-picky.

Aidurber avatar Aidurber commented on August 12, 2024

@karankumar89 Ahhh I see! Thanks for the reproduction steps.
I'll take a look tomorrow some time.

from react-picky.

Aidurber avatar Aidurber commented on August 12, 2024

@karankumar89 @arun567 Closing this. In the codesandboxes they were using React 16.0.0. The library depends on > 16.3.0

See #92 (comment)

Unable to replicate any of the above issues on the new 4.1.1 release with React > 16.3.0

from react-picky.

Related Issues (20)

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.