question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Pagination item not compatible with `labelKey` callback

See original GitHub issue

Version

3.0.4

Steps to reproduce

Use <Typeahead> with options objects array larger than 100 (to trigger pagination) and use labelKey as labelKey={option => option.value}

Expected Behavior

Work properly

Actual Behavior

Crash

Uncaught Error: One or more options does not have a valid label string. Check the labelKey prop to ensure that it matches the correct option key and provides a string for filtering and display.

Further notes

It works with version ~2.3.0~ 2.6.0

Case 1: When I use labelKey={"value"} it works fine.

Case 2: When I use labelKey={option => `${option.value}`} it doesn’t crash anymore, but when scrolling to the bottom, instead of “Display additional results…” I see “undefined”, and when clicking on it, it loads more results as intended. In this case, passing paginationText has no effect, it keeps showing “undefined” (tried both passing string and paginationText={{ value: "Display additional results..." }})

For now I will either disable pagination as the label isn’t always on top level of the object to use labelKey as in case 1, or revert back to ~2.3.0~ 2.6.0 until this is fixed 😕 hopefully it’s easy to fix.

And btw, thanks for all the work and effort put into making this package!

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
ericgiocommented, Apr 24, 2018

Looks like it’s all there in v3.1.1. Sorry about that!

2reactions
ericgiocommented, Apr 24, 2018

This should be fixed as of v3.1.0.

Read more comments on GitHub >

github_iconTop Results From Across the Web

React Bootstrap Typeahead Example
The labelKey prop accepts a callback allowing you to transform your data and return a compound string rather than just a single data...
Read more >
react-bootstrap-typeahead - npm
The component will throw an error if any options are something other than a string or object with a valid labelKey .
Read more >
CheckTreePicker - React Suite
Property Type (Default) Description appearance 'default' | 'subtle' ('default') Set picker appearence block boolean Blocking an entire row cascade boolean whether cascade select
Read more >
React Data Grid: Grid Options - AG Grid
If not specified, it uses the theme value of header-height . ... Callback to be used to customise the chart toolbar items. See...
Read more >
Pagination API - Material UI - MUI
Name Type Default boundaryCount integer 1 classes object color 'primary' | 'secondary' | 'standard' | string 'standard'
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found