question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Synthetic event warning onKeyDown

See original GitHub issue

With the latest version of the daterangepicker i get the following warnings logged if i for example click into the start date input, type something and hit cmd + A.

Warning: This synthetic event is reused for performance reasons. If you're seeing this, you're accessing the method `stopPropagation` on a released/nullified synthetic event. This is a no-op function. If you must keep the original synthetic event around, use event.persist(). See https://fb.me/react-event-pooling for more information.

printWarning	@	warning.js?8a56:36
warning	@	warning.js?8a56:60
warn	@	SyntheticEvent.js?2535:265
get	@	SyntheticEvent.js?2535:259
onKeyDown	@	DateInput.js?2f69:265
invokeFunc	@	index.js?f580:160
trailingEdge	@	index.js?f580:207
timerExpired	@	index.js?f580:195
Warning: This synthetic event is reused for performance reasons. If you're seeing this, you're accessing the method `key` on a released/nullified synthetic event. This is a no-op function. If you must keep the original synthetic event around, use event.persist(). See https://fb.me/react-event-pooling for more information.

printWarning	@	warning.js?8a56:36
warning	@	warning.js?8a56:60
warn	@	SyntheticEvent.js?2535:265
get	@	SyntheticEvent.js?2535:259
onKeyDown	@	DateInput.js?2f69:272
invokeFunc	@	index.js?f580:160
trailingEdge	@	index.js?f580:207
timerExpired	@	index.js?f580:195

I notice that you’re throttling the onKeyDown event handler, so it may be that the event is nullified by the time the handler is actually called, as described here http://stackoverflow.com/questions/35435074/using-debouncer-with-react-event. This makes sense to me as the warning is being thrown on the trailing edge of the throttle.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:15
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
JemarJonescommented, May 17, 2017

I can confirm that modifying the source and setting the trailing to false does fix the issue. I believe this would result in onKeyDown only being called on the leading edge. Another possible solution would be wrapping the call to the throttled handler and persisting the event.

Either fix would be pretty simple so i could make a PR if someone could confirm which solution seems better.

1reaction
cectoncommented, Oct 27, 2017

I’m not 100% sure it is related but I have the problem in 14.0.0 14.1.0 and 13.0.6 by simply pressing SHIFT+TAB to switch to the next field. I have a lot of fields on my page and I want to navigate to the next one.

Nothing special in my code, I just inserted your component today with all the default parameters of the example. I tested on Firefox 56.

“Warning: This synthetic event is reused for performance reasons. If you’re seeing this, you’re accessing the method stopPropagation on a released/nullified synthetic event. This is a no-op function. If you must keep the original synthetic event around, use event.persist(). See https://fb.me/react-event-pooling for more information.” warning.js:33 printWarning warning.js:33 warning warning.js:57 warn SyntheticEvent.js:266 get SyntheticEvent.js:260 onKeyDown DateInput.js:383 invokeFunc debounce.js:95 trailingEdge debounce.js:142 timerExpired debounce.js:130

[edit]: I though it was TAB but it is actually shift+tab so it’s probably more SHIFT

Read more comments on GitHub >

github_iconTop Results From Across the Web

Synthetic event warning onKeyDown · Issue #514 - GitHub
I notice that you're throttling the onKeyDown event handler, so it may be that the event is nullified by the time the handler...
Read more >
SyntheticEvent - React
This reference guide documents the SyntheticEvent wrapper that forms part of React's Event System. See the Handling Events guide to learn more.
Read more >
Warning: This synthetic event is reused for performance ...
This is what React documentation says about it: "The SyntheticEvent is pooled. This means that the SyntheticEvent object will be reused and all ......
Read more >
Getting started with React SyntheticEvent - LogRocket Blog
React SyntheticEvent is a unified cross-browser wrapper around the browser's native events that prevents browser inconsistencies.
Read more >
Debouncing events with React - Medium
Warning: This synthetic event is reused for performance reasons. If you're seeing this, you're accessing the property `target` on a ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found