Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: Value of having a optionValuePath prop #49

Closed
SCasarotto opened this issue Apr 25, 2018 · 7 comments
Closed

Question: Value of having a optionValuePath prop #49

SCasarotto opened this issue Apr 25, 2018 · 7 comments

Comments

@SCasarotto
Copy link
Contributor

SCasarotto commented Apr 25, 2018

This is something I have been thinking about for a while and didn't know if this was something I would build into my wrapper or if it could be beneficial in the library. Currently, when you have an array of objects you can use optionLabelPath to determine what value to display in the selector and search. Would there be value in having an optionValuePath so that when the component is trying to compare selected values it simply string compares instead of handle any object comparison? Obviously, this would require the optionValuePath to always be unique for each option. I haven't looked deeply into how much this would change things in the library but thought it was interesting.

Some Context:
Often, I have an array of objects where the users select an object but we only save a reference key in our database and not the whole object. In order for the component to have the correct initial state (know which option(s) have been selected) I have to recreate the object and pass it as the value instead of simply the reference id.

@selvagsz
Copy link
Owner

@SCasarotto Can you have a look into #43

@selvagsz
Copy link
Owner

I see the use case of optionValuePath. Most users have a wrapper to achieve this, which makes me to double think to make it available in the package

@SCasarotto
Copy link
Contributor Author

Ah totally. I remember reading this a couple weeks ago when you posted it. Render props as you describe would solve this as well. Is that something you are currently working on? Any idea on timeline? Want help?

@selvagsz
Copy link
Owner

I'll spike into this on the weekend. Will keep posted here

@SCasarotto
Copy link
Contributor Author

Appreciate all your hard work!

@selvagsz
Copy link
Owner

selvagsz commented May 2, 2018

@SCasarotto Couldn't find time for this last week. Do you've anytime to help to add optionValuePath support?

@SCasarotto
Copy link
Contributor Author

I think to move toward the render props is the right idea (#43). Are you looking for assistance there?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants