Skip to content

persist the blur event so clients can use it - #24

Open
triptate wants to merge 2 commits into
react-component:masterfrom
pegulabs:persist-blur
Open

persist the blur event so clients can use it#24
triptate wants to merge 2 commits into
react-component:masterfrom
pegulabs:persist-blur

Conversation

@triptate

Copy link
Copy Markdown
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

vercelBot commented Apr 22, 2020

Copy link
Copy Markdown

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

codecovBot commented May 14, 2020

Copy link
Copy Markdown

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 FilesCoverage Δ
src/Mentions.tsx99.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

triptate commented Jul 15, 2021

Copy link
Copy Markdown
ContributorAuthor

@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 freeto 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

@triptate