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

Multipicklist duplicates value data on refresh #15

Closed
TomSesselmann opened this issue Apr 7, 2017 · 12 comments
Closed

Multipicklist duplicates value data on refresh #15

TomSesselmann opened this issue Apr 7, 2017 · 12 comments

Comments

@TomSesselmann
Copy link

The helper.handleValueOnInit function calls child.strike_optionSelected() on each pre-populated option which then sends out a "strike_evt_notifyParent" which then calls helper.addToComponentValue() which adds a new value on to the existing value array.

So you end up with "option-1;option-1" and if you save that data and refresh again you'll get "option-1;option-1;option-1"

I'm running Release 0.1.0 at the moment but I couldn't see a fix in the changelog.

@kevinberonilla
Copy link
Contributor

kevinberonilla commented Apr 7, 2017

@chewy2 or @trentchilders: Do any of you have a solution for this issue?

@TomSesselmann
Copy link
Author

For now, I've just added a quick check before it pushes the duplicate value on to the array.
I'm assuming all the values are unique and there should never be duplicates in the array.

        if (valueArray.indexOf(selectedOptionValue) == -1) { 
            valueArray.push(selectedOptionValue);
        }

@kevinberonilla
Copy link
Contributor

Hi @TomSesselmann, that definitely works. We haven't been able to pinpoint the issue yet on our end. How are you saving the data?

@TomSesselmann
Copy link
Author

It's bound to the field using value="{!v....}" and then saved to Salesforce via an APEX upsert

@TomSesselmann
Copy link
Author

Just updated to 0.6 from 0.1 and still seeing the issue.

If you put a console.log(newValue); at the end of the addToComponentValue function in strike_multiSelectPicklistHelper.js then create a new component like this

<c:strike_multiSelectPicklist
    value="option1;option2" >
    <c:strike_option label="option1" value="option1"/>
    <c:strike_option label="option2" value="option2"/>
</c:strike_multiSelectPicklist>                           

You should see option1;option2;option1;option2 in the console

@kevinberonilla
Copy link
Contributor

Thanks for the update. Our 0.6.0 release was mainly for two new components that have been in the works for quite some time and we decided they were due for a release. It didn't contain many bug fixes.

We will look into this issue for the next patch release.

@kevinberonilla
Copy link
Contributor

kevinberonilla commented Jun 19, 2017

@TomSesselmann We ran into an issue with Multi Select Picklist and found something possibly related to your issue. Try editing the component's helper file (strike_multiSelectPicklistHelper.js) and change the following line (line 8)

valueArray.push(selectedOptionValue);

to

if (valueArray.indexOf(selectedOptionValue) == -1) {
    valueArray.push(selectedOptionValue);
}

This change could fix your issue, and will be part of the next release. Please let us know if this helps!

@TomSesselmann
Copy link
Author

That's the same change that I already suggested above 😛
Yep, that fixes the issue.

@kevinberonilla
Copy link
Contributor

Ahh sorry, you're right! Running into it ourselves reminded me that this issue was still open. I wanted to give you an update. Thanks!

@rsoesemann
Copy link

@kevinberonilla We also ran into this. In September ;-). Is this still in testing because the suggested fix doesn't work? Is there an estimate when you are going to release the fix?

@mikeblazek
Copy link

@up2go-rsoesemann at the moment we do not have an estimate on when we will get another release out. We had believed this was no longer an issue. We currently have a lot of project work, so we will not be able to get back to this for a few weeks.

@lfaz
Copy link

lfaz commented Jan 11, 2018

@TomSesselmann great job, I was also having same issue, luckily it was u that found out. out of curiosity, how did u find out that addToComponentValue was called, or strike_evt_notifyParent is fired. Can u explain a bit!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants