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.

Unwanted re-renders after every dragEnter and dragLeave events

See original GitHub issue

I faced the same problem as desrcibed in 839.

Every dragEnter event causes useDropzone hook changing and re-render of whole component due to the fact, that this line never returns true, so this dispatch runs every time.

How can i prevent this behaviour and stop dragEnter event propagation correctly?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:4
  • Comments:20 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
nejcmcommented, Jan 29, 2021

Yes the return will stop execution but I am facing the same issue. Clicking on the container even with noClick set to true triggers a rerender every time. Will take a look if I find the time.

1reaction
rolandjitsucommented, Oct 25, 2021

Any fix for this? If I upload or drag a file, it gets re-rendered.

That is expected behaviour. On any drag event you will get a render as the hook sets some props that are returned to the user. See https://github.com/react-dropzone/react-dropzone/blob/34bf6dbddd5ba8bd10394e183b5ee017cbf28d6b/src/index.js#L778

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unwanted React Component rerender? - Stack Overflow
When you add a new question, and update the Questions components state variable questions (Array type), the whole component ( Questions and ...
Read more >
How to stop re-rendering lists in React? - Alex Sidorenko
Every time you update the property of one of the components in the list, the entire list re-renders. How to prevent that?
Read more >
HTMLElement: dragleave event - Web APIs | MDN
The dragleave event is fired when a dragged element or text selection leaves a valid drop target. This event is not cancelable.
Read more >
JSDoc: Class: ojChart - Oracle Help Center
A function that returns a custom data label. The function takes a dataContext argument, provided by the chart, with the following properties:.
Read more >
Deprecations Added in Ember 3.x
Event such as originalEvent are deprecated. Especially addons are urged to not use any jQuery specific APIs, so they are able to work...
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