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

[base] Maintain order of documents when collating drafts/published #1665

Merged
merged 1 commit into from Dec 17, 2019

Conversation

rexxars
Copy link
Member

@rexxars rexxars commented Dec 17, 2019

#1422 introduced a change of behavior in collate(), where the order of the passed documents would not be maintained anymore.

I'm not sure if this was intentional, but there is code that depends on the order currently - the desk tool, when showing a list of documents ordered by a specific field, for instance.

This PR switches from using an object (which does not guarantee order) + Object.values, to using a Map - which is guaranteed to maintain order.

@rexxars rexxars requested a review from bjoerge December 17, 2019 10:26
@rexxars rexxars self-assigned this Dec 17, 2019
Copy link
Member

@bjoerge bjoerge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, great catch! Was this causing problems with numeric indices perhaps? Isn't the order of entries in objects determined by the order of which they are added now? I must have forgotten about numeric indices in #1422.

@rexxars
Copy link
Member Author

rexxars commented Dec 17, 2019

Oh, great catch! Was this causing problems with numeric indices perhaps?

Numeric strings, indeed.

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

Successfully merging this pull request may close these issues.

None yet

2 participants