Add prop
pickedOrder
for new selected initial order
#126
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When selecting a new item for the list, the only option was to have the
item pushed to the top. This adds support for two other sorts:
end
pushes the item to end of thecontent
arrayfunction
if the user defines a function they may control where to pushthe new item
start
becomes the default value, keeping the current behaviorDescription of the Change
When selecting a new item for the list, depending on the value of
pickedOrder
new item is pushed on the array ofcontent
according to its value.start
becomes the default value, keeping the current behaviorend
pushes the item to end of thecontent
arrayfunction
if user defined a function they may control where to pushthe new item
As mentioned, keeping the default value at
start
avoids breaking the current behavior.Closes #125
Alternate Designs
I considered only using a boolean value alone with a prop like
pickedOrderEnd
, only to negate the current behavior when needed, but the current approach seems more versatile. Also, adding the option for a function allows the user reach for control of how this is done in some specific cases (e.g. always pushing in alphabetical order).Possible Drawbacks
Given the default behavior is kept, I don't see any at the moment.
Verification Process
I've only done manual testing, but am hoping to open this for feedback, especially for the prop name (
propInitialOrder
, maybe?).Will do some unit testing/e2e depending on how #124 is reviewed (they change the same components and it would be nice to reduce conflicts).
Checklist:
Changelog Entry
Credits
Props @xipasduarte