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

When zipcode selected, sort by distance #115

Merged
merged 1 commit into from
May 9, 2017
Merged

When zipcode selected, sort by distance #115

merged 1 commit into from
May 9, 2017

Conversation

stuartsan
Copy link
Contributor

Fixes #114

This sorts events in the list by distance to selected zipcode, when zipcode is selected.

// When a zipcode is selected, sort events by proximity to that zipcode.
if (filters.zipcode) {

filteredEvents.sort((a, b) => {
Copy link

Choose a reason for hiding this comment

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

is this sort mutating the list or returning a new one?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Mutation city!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

...but FWIW this is not the original, canonical data source being mutated, it is a new list generated within this function.

@stuartsan stuartsan merged commit 1591e52 into master May 9, 2017
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.

2 participants