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.

Categories don't work as expected

See original GitHub issue

That documentation states that:

NOTE The items don’t need to be sorted, This will be done automatically.

However, this example from docs:

const [items, setItems] = useState([
  {label: 'North America', value: 'na'},
  {label: 'United States', value: 'usa', parent: 'na'},
  {label: 'Canada', value: 'canada', parent: 'na'},

  {label: 'Europe', value: 'eu'},
  {label: 'Norway', value: 'norway', parent: 'eu'},
  {label: 'Belgium', value: 'belgium', parent: 'eu'},
]);

works differently than this:

const [items, setItems] = useState([
    {label: 'United States', value: 'usa', parent: 'na'},
    {label: 'Canada', value: 'canada', parent: 'na'},
    
    {label: 'Norway', value: 'norway', parent: 'eu'},
    {label: 'Belgium', value: 'belgium', parent: 'eu'},
    {label: 'Europe', value: 'eu'},
    {label: 'North America', value: 'na'},
]);

The second code only has item order changed and results in every item without parent being categorized as “Europe”. Not sure if this is a bug or the expected behavior. If it is a bug I will help tracking down where it comes from, if not I suggest adjusting the documentation.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
KrisGiliczecommented, Aug 27, 2021

I try to do it this weekend, not sure how to detect if hermes is enabled though. Would a patch be fine for all engines? Edit: Hermes is the de facto standard with react native, and the sort you linked will work on both with no noticable runtime difference.

1reaction
KrisGiliczecommented, Aug 27, 2021

I only have a little time right now but as far as I can tell this might be an issue on hermes specifically. Array prototype sort is not stable when turning hermes on, see this issue here.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Product categories not working as expected | WordPress.org
I am trying to update a client's site to a new template. I'm using WP Staging. Everything works as expected with the staging...
Read more >
Outlook categories not working correctly - Microsoft Community
Open Outlook in safe mode. 2. Try to repair the Outlook data file. While if not, before we process further, please try to...
Read more >
Browse Api - multiple categories not working as expected
According to the docs, a list of categories can be passed to the browse api to get specific types of locations/businesses.
Read more >
Saved posts categories feature not working as expected - Reddit
I have been able to create categories, but see no way to save posts to them. Also see no way to categorize previously...
Read more >
Filtering with 'Categories' and 'Special Items (Videos)' does ...
Filtering with 'Categories' and 'Special Items (Videos)' does not work as expected. 12-30-2021, 07:53 AM. Using ACDSee Home 2022.
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