Skip to content

Conversation

@ssetrom
Copy link

@ssetrom ssetrom commented Jul 20, 2021

This PR adds two convenient events:

  1. "itemRemoved": An event for when you remove an item. The detail of this event is the item removed.
  2. "itemSelected": An event for when you select an item. The detail of this event is the item selected.

I also added the "itemCreated" event to the documentation.

@ssetrom ssetrom marked this pull request as ready for review July 20, 2021 15:02
@rob-balfre
Copy link
Owner

@ssetrom thanks for the PR. There is already on:select and on:clear so not sure these add anything new.

@ssetrom
Copy link
Author

ssetrom commented Jul 21, 2021

@rob-balfre Ah, I should probably have written more about how these events are different. So 'itemSelected' is only ever triggered when the user directly changes a value, and it only returns the one value that was selected/added. This is important because the 'select' event is always triggered when the data changes ( It can happen because of multiple reasons, for instance the value prop changing ).

Upon some investigation, I've found that actually the 'clear' event totally does what I want it to do! Sorry about that. I believe I added that event for an earlier version, and it was probably solving some issue that no longer exists :)

@rob-balfre
Copy link
Owner

@ssetrom I think I'd prefer to change the PR to update on:select to only fire when an item is selected instead of having another event.

@rob-balfre
Copy link
Owner

Events in v5 can achieve same result.

Thanks for the PR though and very sorry for slow reply.

@rob-balfre rob-balfre closed this Apr 12, 2022
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

Successfully merging this pull request may close these issues.

3 participants