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

[Bug] Ngx-dropzone duplicated events #291

Closed
MikeDabrowski opened this issue Apr 8, 2021 · 3 comments
Closed

[Bug] Ngx-dropzone duplicated events #291

MikeDabrowski opened this issue Apr 8, 2021 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@MikeDabrowski
Copy link

Current behavior:

When using this plugin to upload files onto ngx-dropzone (angular) the changes output fires twice.
This happens when using subject 'drag-n-drop'. When using 'input' output fires once but the event that it is passed is of wrong type (CustomEvent). Current workaround would be to modify my app to handle that CustomEvent structure too, or to debounce that event.

Desired behavior:

It should only fire once.

Steps to reproduce: (app code and test code)

I'm pasting the most relevant pieces. If anything else is necessary please ask for it in the comment.
When cypress executes this step, files are 'dropped' twice, and I got duplications all over the app.

<ngx-dropzone (change)="handleFileInput($event)" >
handleFileInput(stuff: NgxDropzoneChangeEvent) {
    console.log('handleInput', stuff); // fires twice
    //... handle files somehow ...
  }
const files = [{
     filePath: `pdfs/valid.pdf`,
      mimeType: 'application/pdf',
      encoding: 'utf-8',
}];
cy.get('ngx-dropzone')
      .should('exist')
      .attachFile(files, { subjectType: 'drag-n-drop' });

Versions

"ngx-dropzone": "^2.4.0",
"cypress-file-upload": "^5.0.4",
"cypress": "^7.0.0",
@MikeDabrowski MikeDabrowski added the bug Something isn't working label Apr 8, 2021
@abramenal
Copy link
Owner

Hi @MikeDabrowski
Thanks for submitting the issue!

I think it is related to #290

@abramenal
Copy link
Owner

@MikeDabrowski v5.0.5 is just released, can you please check if this issue still persists?

@MikeDabrowski
Copy link
Author

MikeDabrowski commented Apr 9, 2021

@abramenal I can confirm it works with v5.0.5. Good catch!

For anyone wondering: #290 removed 'change' event which was causing the output's second emission.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants