Skip to content

MenuItem component only displays a subset of suggestions #846

Closed
@tugbargn

Description

@tugbargn

Version
"react-bootstrap-typeahead": "^6.3.2",

Steps to reproduce
Populate the suggestions array with a large number of items.
Render the Typeahead component with the populated suggestions array.
Scroll through the menu to view all suggestions.
Expected Behavior
All suggestions received from the server should be displayed in the menu of the Typeahead component, regardless of the viewport.

Actual Behavior
Only a subset of the suggestions is displayed in the menu. This occurs because the MenuItem component inside the renderMenu function is optimized to render only the items currently visible in the viewport. As a result, not all suggestions are displayed, which can lead to a discrepancy between the suggestions received from the server and those visible in the menu.

Additional Information
To address this issue, modify the renderMenu function to directly map through all suggestions in the suggestions array, rather than relying on the results array passed to the renderMenu function. This ensures that all suggestions are rendered in the menu, regardless of the viewport. Additionally, ensure that the suggestions array is correctly populated with all suggestions received from the server before rendering the Typeahead component. If the issue persists, double-check the data received from the server to ensure it contains all expected suggestions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions