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.
Fixes #142
Props in react can change over time, so they should not be saved when a component first mounts and then never updated. This causes issues when you, say, have a dynamic callback in
onSelection
that changes over time. Without this change, this library was calling the old/outdated callback instead of the most recent one.This is a quick and easy fix, though I imagine a better fix would involve rewriting more of the code here. I don't see any reason for this to be problematic though. I've used this in my own project where I observed the bug and this does resolve it.
This PR includes
/dist
which is built vianpm run prePublishOnly && git add -f ./dist/
, which we wouldn't include before merging this PR. But in order to use this fork/branch directly inpackage.json
I believe this was necessary for now.For anyone else wanting to use this fork to fix #142 before it is merged, you can use this line in your
package.json
: