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.

this.refs.dropzone.open() can't get invoked in a Promise().then()

See original GitHub issue

To reproduce the bug Try this:

new Promise((res, rej) => {
    //Simulate a Async promise
    setTimeout(() => {
        res('ok');
    }, 1000);
})
.then(() => {
   //call dropzone.open in then()
    this.refs.dropzone.open();
});

Nothing happen after open is called.

Help Thanks.

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:16

github_iconTop GitHub Comments

2reactions
Nodmancommented, Jun 1, 2018

@bbthorntz For security reasons browser blocks all the popups and dialogues that was opened not directly by user interaction, or those which were opened programmatically but with a delay not greater than 1000 ms. If 1000ms dealy is your usual case, then you probably want to rework UI/UX flow somehow to prevent this, because I am pretty sure that there is no good workaround for this

Here some proofs

1reaction
okonetcommented, Jun 1, 2018

It would be great to have it in docs I think. PR?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Return promise on an event - javascript - Stack Overflow
Return promise inside the event like dropZone.addEventListener('drop', function(event) { return new Promise(function(resolve, ...
Read more >
react-dropzone
Simple React hook to create a HTML5-compliant drag'n'drop zone for files. ... IMPORTANT: do not set the ref prop on the elements where...
Read more >
react-dropzone - npm
Start using react-dropzone in your project by running `npm i ... getInputProps() props are set, instead, get the refs from the hook itself:....
Read more >
Migration Guide | Cypress Documentation
Migrating to Cypress 12.0 This guide details the changes and how to change your code to migrate to Cypress version 12.0.
Read more >
Dropzone - Mantine
Dropzone lets you capture one or more files from user. ... To open files browser from outside of component use openRef prop to...
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