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.

Select: order of keys does not follow insertion orders when mixing string and numbers

See original GitHub issue

For now, options with custom labels in a select input is achieved by passing an Object: Story Book Demo. However, the order of the rendered options is determined by Object.keys() or Object.values(), and does not (always) follow the insertion order, which makes this feature kind of a no-go. AFAIK, Map seems to be a more feasible option?

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:11 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
dbismutcommented, Feb 20, 2022

Sure I wouldn’t mind the Map. Feel free to propose a PR. In the meantime, although this is not a very elegant solution, you can always add a space after the number key so that it considered a string. Therefore the order should be respected.

0reactions
Sec-antcommented, Feb 20, 2022

Sure I wouldn’t mind the Map. Feel free to propose a PR. In the meantime, although this is not a very elegant solution, you can always add a space after the number key so that it considered a string. Therefore the order should be respected.

OK, I’ll see what I can do.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Keep the order of the JSON keys during JSON conversion to ...
println("Ordered JSON Fianl CSV :: "+CDL.toString(jsonArray));. So there is no need to change the JSONObject.java class . Hope it helps somebody .
Read more >
Sorting a Python Dictionary: Values, Keys, and More
An essential point to understand when sorting dictionaries is that even though they conserve insertion order, they're not considered a sequence.
Read more >
3. Strings, lists, and tuples — Beginning Python Programming ...
Strings, lists, and tuples are all sequence types, so called because they behave like a sequence - an ordered collection of objects.
Read more >
Binary Insertion Sort - GeeksforGeeks
Binary insertion sort is a sorting algorithm which is similar to the insertion sort, but instead of using linear search to find the...
Read more >
Using Group By and Order By in the Same Query - Navicat
Notice that, once you include the Order By clause, the default group ordering is lost. If you'd like to keep it, you can...
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