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

🐛 Fixed "Cannot read property 'feature_image' of undefined" #10602

Merged
merged 4 commits into from
Mar 13, 2019

Conversation

kirrg001
Copy link
Contributor

@kirrg001 kirrg001 commented Mar 12, 2019

@@ -16,10 +16,12 @@ function getContextObject(data, context) {
// @TODO: meta layer is very broken, it's really hard to understand what it's doing
// The problem is that handlebars root object is structured differently. Sometimes the object is flat on data
// and sometimes the object is part of a key e.g. data.post. This needs to be prepared at the very first stage and not in each helper.
if (_.includes(context, 'page') || _.includes(context, 'amp') && data.post) {
if ((_.includes(context, 'page') || _.includes(context, 'amp')) && data.post) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

missing braaaces 🤬

chosenContext = data.post;
} else if (_.includes(context, 'post') && data.post) {
chosenContext = data.post;
} else if (_.includes(context, 'page') && data.page) {
chosenContext = data.page;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added this extra case to ensure the data is returned for the case of using data: page.slug.
Dynamic routing has added a lot of extra cases for the meta layer, refs #10082.

pages: [{redirect: true, slug: 'static-page-test'}]
}
}
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The use case was not covered in dynamic routing regression test. Now it's there.
It errors on master

Copy link
Contributor Author

Choose a reason for hiding this comment

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

🤓

Copy link
Member

Choose a reason for hiding this comment

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

Hm.. Tried it on master, didn't error 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It hangs!

Copy link
Member

Choose a reason for hiding this comment

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

You were right 👍 my 🅱️

@naz naz merged commit f64af76 into TryGhost:master Mar 13, 2019
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