Categories don't work as expected
See original GitHub issueThat 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:
- Created 2 years ago
- Comments:6 (3 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

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.
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.