-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
transformHeader called twice #1029
Comments
I guess the example I've posted is working as expected. |
Hey @samy-mssi! |
Hey, thanks for the quick reply, I managed it by adding a simple condition
it works in my case, but it seems weird that I have this issue after upgrading my project.. I still think there is something to fix in papaparse. |
I have the same situation with just a simple header.trim() being run on each value. I also tried pushing into an array and was duplicate values and debugged by adding console.log(header) and got a complete listing of the headers and then an other complete listing. I tested everything to make sure I wasn't calling parse more than once and it seems to be run twice in PapaParse itself. For anyone else seeing this issue, I was able to work around by using Set on the output array I was creating:
EDIT: To clarify, the above code was run after the parse on the array I was pushing into during the parse. Here is a more robust example:
and then after the parse:
|
Does it work with PapaParse version |
My problem was happening in |
I have this sample code
This is the result from running it:
It's interesting that the second argument starts as a string and then becomes a number. I think this suggests transformHeader is being executed from different lines each time.
Logging "header" returns this:
"First name"
"Last name"
"First name"
"Last name"
It seems like transformHeader is executed twice for the first row. This is causing a bug in my application and I don't know why this behavior is happening.
I'd really appreciate some help with it. Thanks in advance!!
The text was updated successfully, but these errors were encountered: