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

persist the blur event so clients can use it #24

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

triptate
Copy link
Contributor

This fixes a bug where the event that is passed to the onBlur prop will be nullified because the code is executed asynchronously using a timeout. I expect there's a good reason why the timeout is necessary; however, if it were not necessary, then removing the timeout would be a simpler and more efficient solution to this problem since event.persist() creates a copy of the event.

@vercel
Copy link

vercel bot commented Apr 22, 2020

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/react-component/mentions/lr8wg2lbx
✅ Preview: https://mentions-git-fork-pegulabs-persist-blur.react-component.now.sh

@codecov
Copy link

codecov bot commented May 14, 2020

Codecov Report

Merging #24 into master will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master      #24   +/-   ##
=======================================
  Coverage   99.13%   99.13%           
=======================================
  Files           6        6           
  Lines         230      232    +2     
  Branches       52       53    +1     
=======================================
+ Hits          228      230    +2     
  Misses          2        2           
Impacted Files Coverage Δ
src/Mentions.tsx 99.30% <100.00%> (+<0.01%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e613351...079e17d. Read the comment docs.

@triptate
Copy link
Contributor Author

triptate commented Jul 15, 2021

@afc163 this one didn't seem to need a test case; however, an alternative strategy would be to add a prop that allows the client to indicate if they would like the event to be persisted in this case (e.g. persistOnBlur). in this case, this code would only run conditionally if the prop is included, and it would need a test case as well. let me know if you'd like me to rewrite this using that approach.

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.

1 participant