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

fix(edition) : Cannot read property 'year' of undefined #344

Merged
merged 1 commit into from
Jan 21, 2020

Conversation

prabalsingh24
Copy link
Contributor

Problem

https://tickets.metabrainz.org/browse/BB-395
Cannot read property 'year' of undefined

Solution

Now it checks if data.editionSection.releaseDate exists or not

Areas of Impact

@@ -339,7 +339,7 @@ function transformNewForm(data) {
);

let releaseEvents = [];
if (data.editionSection.releaseDate.year) {
if (data.editionSection.releaseDate && data.editionSection.releaseDate.year) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think this would've worked also if(data.edition.releaseData){.. because year is an empty string by default and will always be present.
But I think it's better to be safe :)

Copy link
Member

Choose a reason for hiding this comment

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

Indeed. I think also if by any chance you get something other than a {year,month,day} object (like a date string), calling dateObjectToISOString with it will throw an error.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 42.982% when pulling 2c59787 on prabalsingh24:fix-BB-395 into 5edfefc on bookbrainz:master.

Copy link
Member

@MonkeyDo MonkeyDo left a comment

Choose a reason for hiding this comment

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

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

Successfully merging this pull request may close these issues.

3 participants