-
-
Notifications
You must be signed in to change notification settings - Fork 172
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
Options props can be mutated - options behaviour comment in v0.9.1 #1126
Comments
For info |
Hey and thanks for your feedback!!
At first I used the |
Regarding the options prop interface: Short explanation of the options prop type:
And a more detailed explanation will surely follow in the docs (see #1079). |
For example, with the autocomplete component, having the options already rendered and only hiding them using |
related to #1105 |
@dauriata Can this be closed? Or do you have any more question? |
Everything might not be relevant but to follow the discussion I'll share my use case and my thoughts : I have a customer dataset in store as an array of thousand objects with property Doing so is not possible to tell the select field is So I think the only solution for my use case is to craft a special copy of my options array. Going down the code I notice there are two more copies of the data inside the component, a tree version as Performance wise when input dataset might be large, I think it is good to have a versatile api that can directly use input data without duplication.
Another note off topic, I think the clear button should also clear input search text and not only the selected item. |
I appreciate your feedback and your deep thoughts on the topic!
First, this implementation is specifically used to not mutate the data passed in the
I was trying to find a pattern that could be used by any component that has an Also, the
The
The
Sure, this is a bug that I have encountered myself. Will be fixed in the future. |
Here is an example codesandbox, that happen when there are no
Yes but my all point was to be able to use input data as they are, not having to make a copy with specific attributes names when the dataset is big. I am no expert but would not it be preferable to use an internal object that ref the initial array objects with added custom attributes like |
Sorry, I can't open your example...
Normally there should be a type error if the
I understand your point. But I think pre-processing your options isn't that big of a deal with computers these days, and if your dataset is that huge, maybe you should consider thinking about your data and application structure instead?
Hmm, I will think about it. However, Oruga doesn't touch and mutate the |
Oruga version: 0.9.1
Thanks for all the work done with v0.9 ! I have some questions / comments regarding the new options api in v0.9.1
I would have expected to be able to pass any object as options, and maybe tell what should be the "value" and "label" field, and/or use slot for label.
With version 0.9.1 it seems to be very specific, object are required to have a value property, if not the props are mutated by adding a "hidden" property which seems not good as it can have side effect on the rest of the app.
It looks like it should also not have a key property or it else it would be overwritten.
I am also concerned how this would scale for large datasets ( maybe not for tabs or steps that would not go over 10 entries but certainly for autocomplete where it could be common to search across thousand entries )
I see that all options are rendered in the DOM even when hided, this may not be optimal.
And maybe I don't get all the implication but I also think that using crypto.randomUUID is overkill, I think a simple sequence counter would do if at all needed. Why not use the index of the returning options array as key ?
The text was updated successfully, but these errors were encountered: