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

Artist insights 2.0 - Some artists with 1 badge don't have insights displayed #2125

Merged
merged 4 commits into from
Mar 12, 2019

Conversation

lilyfromseattle
Copy link
Contributor

@lilyfromseattle lilyfromseattle commented Mar 7, 2019

Problem:
Blek le rat has 1 badge and it displays, but Dustin Yellin also has one badge (reviewed by ArtForum) and his Artist Insights isn't displayed.

Solution:
Check to display the SelectedCareerAchievements component included a check on artist.insights.length, but there was a return inside the component's render that didn't include this check and was returning for artists with insights, so I added it there as well.

Before:
screen shot 2019-03-07 at 11 27 24 am

After:
screen shot 2019-03-07 at 11 26 16 am

@peril-staging peril-staging bot added the Version: Patch Indicates that this PR should have a patch deploy, usually for bug fixes label Mar 7, 2019
@sweir27
Copy link
Contributor

sweir27 commented Mar 7, 2019

🎉 And thanks for including screenshots!!

Could you add a little description of what the change was/why you had to make it? It's not totally clear to me! (for reference @ashkan18 has some good PR description formats for this 😄i.e. https://github.com/artsy/vortex/pull/28)

if (!hasSections(this.props.artist)) {
if (
!hasSections(this.props.artist) &&
this.props.artist.insights.length === 0
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we add a test that would have caught this case?

@artsyit
Copy link
Contributor

artsyit commented Mar 7, 2019

Deploy preview for artsy-reaction ready!

Built with commit cf3a98d

https://deploy-preview-2125--artsy-reaction.netlify.com

if (!hasSections(this.props.artist)) {
if (
(!hasSections(this.props.artist) && !this.props.artist.insights) ||
this.props.artist.insights.length === 0
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it possible for hasSections(this.props.artist) to be true but this.props.artist.insights to be null? Because then you might get a cannot read property 'length' of null error here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Had my parentheses in the wrong place my bad!

it("renders selected career achievements if no auction results or partner highlights", async () => {
ArtistFixture.auctionResults = null
ArtistFixture.highlights.partners = null
wrapper = await getWrapper(ArtistFixture)
Copy link
Contributor

Choose a reason for hiding this comment

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

For good data hygiene we should avoid mutating the ArtistFixture in these tests. Although the mutations can't escape outside of the bounds of this file (because of the way jest executes test files in isolation) it could cause confusing problems if people add or modify tests here in the future.

The idiomatic and safe thing to do would be to construct a new version of the artist fixture using object spread syntax, e.g.

wrapper = await getWrapper({
   ...ArtistFixture,
   auctionResults: null,
   highlights: {
    ...ArtistFixture.highlights,
    partners: null
   }
})

@sweir27 sweir27 merged commit d258b03 into artsy:master Mar 12, 2019
@ds300 ds300 mentioned this pull request Mar 13, 2019
@artsyit
Copy link
Contributor

artsyit commented Mar 13, 2019

🚀 PR was released in v15.2.2 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
released Version: Patch Indicates that this PR should have a patch deploy, usually for bug fixes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants