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

Strike Select - doneRendering needs to check for v.value is present #92

Closed
chewy2 opened this issue Oct 4, 2017 · 3 comments
Closed

Comments

@chewy2
Copy link

chewy2 commented Oct 4, 2017

The doneRendering code needs to be moved to an afterRender in the renderer. The doneRender code only needs to be ran once, but its currently running infinite times and causing infinite loops under certain conditions.

@chewy2
Copy link
Author

chewy2 commented Oct 4, 2017

It appears we need to use the doneRendering event to handle the addition of options through a callback. In this case we need to also make sure that the doneRender checks to see if there is a v.value as well as a v.valueLabel otherwise when a component gets destroyed its stuck in an infinite loop due to not having a label, but theres no value to set a label.

@chewy2 chewy2 changed the title Strike Select - Should not use doneRendering event Strike Select - doneRendering needs to check for v.value is present Oct 4, 2017
@daneowens3
Copy link
Contributor

expect this to be resolved in our next release, added the check for v.value.

@cnaccio
Copy link

cnaccio commented Dec 30, 2017

@chewy2 I think I ran into this issue today with version 0.9.0 of the select component. I started receiving the error below in certain circumstances. Is this the same thing?

image

Here's the specific offending code/function in file strike_selectHelper; more specifically this line component.get('v.body').forEach(function(child) {

    getChildOptions: function(component, event, helper) {
        var options = [];

        component.get('v.body').forEach(function(child) {
            if ($A.util.isUndefined(child.select)) {

                var childOptions = helper.getChildOptions(child, event, helper);

                options = options.concat(childOptions);
            } else {
                options.push(child);
            }
        });

        return options;
    }

The function above is eventually called, but the top of the stack trace is this function in the same file:

getLabelByValue: function(component, event, helper) {
        helper.findChildOptionFromValue(component, event, helper);
}

Which calls this function

    findChildOptionFromValue: function(component, event, helper) {
        var options = helper.getChildOptions(component, event, helper);

        options.forEach(function(option, i) {
            if (option.get('v.value') === component.get('v.value')) {
                option.select();
                component.set('v.focusIndex', i);
                component.getEvent('onchange').fire();
            }
        });
    }

The line var options = helper.getChildOptions(component, event, helper); calls the first function I included above.

Any help, or insight would be much appreciated. Thanks in advance!

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

3 participants