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

Don't mutate options when calling extend #3778

Merged
merged 1 commit into from
Jun 13, 2023

Conversation

rainhead
Copy link
Contributor

@rainhead rainhead commented Jun 13, 2023

Fixes: #3746.

Please try this out locally. It wasn't easy to figure out how to set up test data.

Before:
Screenshot 2023-06-13 at 1 36 30 PM

After:
Screenshot 2023-06-13 at 1 36 08 PM

In some places we're good about extending into a new object, in others we're not.

@kueda kueda merged commit 0d7909b into inaturalist:main Jun 13, 2023
16 checks passed
@rainhead rainhead deleted the 3746-wrong-iconic-taxon branch June 13, 2023 23:17
Comment on lines 99 to 103
$.extend(
{},
$.fn.simpleTaxonSelector.styles.statuses['default'],
$.fn.simpleTaxonSelector.styles.statuses.unmatched
)
Copy link
Contributor

Choose a reason for hiding this comment

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

In case you don't already know, you can do this instead without needing lodash/underscore:

$(status).css({
    ...$.fn.simpleTaxonSelector.styles.statuses['default'],
    ...$.fn.simpleTaxonSelector.styles.statuses.unmatched
})

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for reaching out. There's quite a lot that could be improved with modern JS here, but I'm trying to stay consistent within a code unit, and to make minimal changes. Also, the most important calls to extend here perform deep merges, which I don't think I can do with plain JS.

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.

Wrong iconic taxon shown in search results for adding taxa to list
3 participants