Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sorted Immutable Map Not Rendering Correctly #23

Closed
mmoravec opened this issue May 2, 2017 · 3 comments
Closed

Sorted Immutable Map Not Rendering Correctly #23

mmoravec opened this issue May 2, 2017 · 3 comments

Comments

@mmoravec
Copy link

mmoravec commented May 2, 2017

I have an immutable map that looks like:

data = {
---header1: {
------prop1:
------prop2:
------etc...
---}
---header2: {
------etc...
---}
}

I can't figure out how to get the headers to show up in the correct order with this library. i.e.

header1
header1 data
header2
header2 data

They are currently displaying

header2
data
header1
data

Do I need to set a section ID somewhere?

@cooperka
Copy link
Owner

cooperka commented May 2, 2017

Hi @mmoravec, it's possible there's a bug, but I don't think JavaScript makes any guarantees about ordering for objects. You could try using this to preserve order:

Immutable.OrderedMap([[key1, value1], [key2, value2]])

If that doesn't work, please post a working demo app and I can take a look!

P.S. to format code on GitHub and preserve indentation, you can surround your code with triple ticks on the lines above and below (```).

@mmoravec
Copy link
Author

mmoravec commented May 3, 2017

Hey @cooperka thanks for the tips, I'll let you know how the OrderedMap works out.

@mmoravec
Copy link
Author

OrderedMap works well. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants