Skip to content
This repository was archived by the owner on Jul 19, 2019. It is now read-only.
This repository was archived by the owner on Jul 19, 2019. It is now read-only.

Poor render performance on lists of >500 items #140

Open
@carlpaten

Description

@carlpaten

I took the code from the static-data example and stuck it into an internal LOB application. The list of items contains ~700 entries. The first few keystrokes take about a second to register each, less and less as branches are culled out of the render tree.

One solution would be to add a props that sets a maximum limit of elements to render. Nobody wants to browse through a 700 element list, so all of that rendering effort is not going into good use anyway.

My work-around: having a local variable in render() that tracks the amount of items rendered. When it gets high enough, shouldItemRender returns false unconditionally.

let rendered = 0;
const maxRendered = 20;

let shouldItemRender = (branch, state) => {
    if (rendered < maxRendered) {
        let shouldRender = branch.Name.toUpperCase().indexOf(this.state.value.toUpperCase()) !== -1;
        if (shouldRender) {
            rendered += 1;
        }
        return shouldRender;
    } else {
        return false;
    }
}

EDIT: the above work-around actually isn't one, it breaks everything else. See #443.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions