added additional conditional statements#9
Open
ralpdexterbongato wants to merge 1 commit intogridsome:masterfrom
Open
added additional conditional statements#9ralpdexterbongato wants to merge 1 commit intogridsome:masterfrom
ralpdexterbongato wants to merge 1 commit intogridsome:masterfrom
Conversation
added additional statements for the category and tags, I found that if the post doesn't have a category or a tag selected, It will give an error saying cannot read property of length. by checking first if a tag or category exist fixed it.
Member
|
I had this problem too. I think you can simplify this request by just checking the property itself. You don't need to check for != null and then the length. You should be able to just do this.
If the tag or category returns null it will evaluate to false and will not show that section. |
hjvedvik
reviewed
May 13, 2019
| /> | ||
| <div v-html="$page.wordPressPost.content"/> | ||
| <template v-if="$page.wordPressPost.categories.length"> | ||
| <template v-if="$page.wordPressPost.categories!=null && $page.wordPressPost.categories.length"> |
Member
There was a problem hiding this comment.
Suggested change
| <template v-if="$page.wordPressPost.categories!=null && $page.wordPressPost.categories.length"> | |
| <template v-if="$page.wordPressPost.categories"> |
| </ul> | ||
| </template> | ||
| <template v-if="$page.wordPressPost.tags.length"> | ||
| <template v-if="$page.wordPressPost.tags!=null && $page.wordPressPost.tags.length"> |
Member
There was a problem hiding this comment.
Suggested change
| <template v-if="$page.wordPressPost.tags!=null && $page.wordPressPost.tags.length"> | |
| <template v-if="$page.wordPressPost.tags"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
added additional statements for the category and tags, I found that if the post doesn't have a category or a tag selected, It will give an error saying cannot read property of length. by checking first if a tag or category exist fixed it.