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

Tabs2 NPEs if passed no children #841

Closed
AndyMoreland opened this issue Mar 15, 2017 · 0 comments
Closed

Tabs2 NPEs if passed no children #841

AndyMoreland opened this issue Mar 15, 2017 · 0 comments
Assignees
Milestone

Comments

@AndyMoreland
Copy link

AndyMoreland commented Mar 15, 2017

Admittedly this is kind of stupid, but Tabs2 NPEs if passed no children. It probably should just do nothing.

    Tabs2.prototype.getInitialSelectedTabId = function () {
        var _a = this.props, defaultSelectedTabId = _a.defaultSelectedTabId, selectedTabId = _a.selectedTabId;
        if (selectedTabId !== undefined) {
            return selectedTabId;
        }
        else if (defaultSelectedTabId !== undefined) {
            return defaultSelectedTabId;
        }
        else {
            // select first tab in absence of user input
            // NOTE: providing an unknown ID will hide the selection
            return this.getTabChildren()[0].props.id;
        }
    };

Note the code line: this.getTabChildren()[0].props.id;. Dies if getTabChildren() is undefined which occurs when there are no children.

@llorca llorca added this to the 2.x milestone Mar 15, 2017
@giladgray giladgray modified the milestones: 1.13.0, 2.x Mar 17, 2017
@giladgray giladgray self-assigned this Mar 17, 2017
giladgray pushed a commit that referenced this issue Mar 17, 2017
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