Closed acourtiol closed 4 years ago
This is a known issue. I'm mobile right now and can't remember which number, (and my Internet is down) but take a look at the open issues and you will find the previous discussion.
@mholt Thanks for the answer, I searched through the search tool but didn't find anything like that. I'll double check.
I seem to be having the exact same problem: as soon as I load up a second file in an input file element, PapaParse somehow calls the complete two times. My code:
$('input').change(function(event) {
file = event.target.files[0];
});
Papa.parse(file, {
header: true,
dynamicTyping: true,
skipEmptyLines: true,
encoding: 'UTF-8',
beforeFirstChunk: function(chunk) {
return chunk.replace(regex, '');
},
complete: function(results) {
//doing some stuff with results.data
}
Tried to find the related issue, but couldn't locate it. Would you be so kind to refer me to it? Thanks for your great work :-)
I just found out that this has nothing to do with Papa in the end ;-). My form was submitting multiple times because I didn't detach it before attaching it. This fixed it:
$('#form').off('submit').on('submit', function(e) {
// do stuff
}
Hope this helps anyone with the same issue!
I'm having the same issue. I'm starting the Papa.parse on file input change event. The chunk function is only run once (testing with a small file), but the complete function is run twice.
I'm having trouble reproducing this. Are you guys running 4.1.2?
Yeah, running 4.1.2. I just realized that this only happens for me when parser.abort() is called from within the chunk function.
I'll try to take a look at this soon. (got quite the backlog!)
Any update on this?
i'm seeing this issue as well.
I'm swamped with another project. Anyone is welcome to issue a PR to fix it.
I'm seeing this. The parsing runs once (confirmed by a console.log) but the complete function runs twice. I'll see what I can find in the code. @mholt Any suggests where to look would be appreciated. And thanks for the great package, it's a huge help for my project.
@repjackson Sorry, I'm super busy right now with other things, but using the debugging tools and some console.logs you or someone can probably pinpoint the cause without too much trouble!
Ok thank you for the quick response.
On 3/10/16, Matt Holt notifications@github.com wrote:
@repjackson Sorry, I'm super busy right now with other things, but using the debugging tools and some console.logs you or someone can probably pinpoint the cause without too much trouble!
Reply to this email directly or view it on GitHub: https://github.com/mholt/PapaParse/issues/231#issuecomment-195170325
i'm seeing this issue right now
I got around this by doing:
secondIteration = false
Papa.parse csvToParse,
header: true
complete: (results, file) ->
if secondIteration then return
else
// code
secondIteration = true
See https://github.com/mholt/PapaParse/pull/479#issuecomment-379918392 for a partial solution that can be expanded if people are still experiencing this.
Hello,
I'm having the following issue.
When I call papaparse like this:
With the following string:
The complete function get called two times in a row with the following data:
I parse multiple files but I'm having the issue only on this one.
Thanks.