Skip to content

Breadcrumb throws Error when rendered with default props #4663

Description

@ThomasMichon

Bug Report

For [email protected]

Priorities and help requested (not applicable if asking question):

Priority: High

Describe the issue:

The Breadcrumb component throws an Error when rendered with its own default props.

If you pass an empty items array, then an error is thrown in _validateProps, because overflowIndex > items.length - 1, since overflowIndex is 0 by default and items.length is 0`.

This is a recently-introduced regression.

Actual behavior:

return (
    <Breadcrumb items={ [] } />
);

Throws:

___.js:17621 Uncaught Error: Breadcrumb: overflowIndex out of range
    at Breadcrumb._validateProps (___.js:17621)
    at new Breadcrumb (___.js:17589)
    at constructClassInstance (react.js:8597)
    at updateClassComponent (react.js:10081)
    at beginWork (react.js:10467)
    at performUnitOfWork (react.js:12466)
    at workLoop (react.js:12530)
    at HTMLUnknownElement.callCallback (react.js:2280)
    at Object.invokeGuardedCallbackDev (react.js:2319)
    at invokeGuardedCallback (react.js:2176)

Expected behavior:

Should render an empty breadcrumb, with no items.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions