Handle when entry descriptions/links are missing

Just for safekeeping, all properties should still be defined even if it is empty
This commit is contained in:
Hans5958 2023-04-22 13:19:30 +07:00
parent d292ffc825
commit 94147ae2dc
2 changed files with 5 additions and 5 deletions

View file

@ -102,7 +102,7 @@ function createInfoBlock(entry, isPreview) {
}
}
if (entry.links.subreddit?.length) {
if (entry.links?.subreddit?.length) {
const subredditGroupElement = baseGroupElement.cloneNode()
linkListElement.appendChild(subredditGroupElement)
@ -116,7 +116,7 @@ function createInfoBlock(entry, isPreview) {
})
}
if (entry.links.website?.length) {
if (entry.links?.website?.length) {
const websiteGroupElement = baseGroupElement.cloneNode()
linkListElement.appendChild(websiteGroupElement)
@ -134,7 +134,7 @@ function createInfoBlock(entry, isPreview) {
})
}
if (entry.links.discord?.length) {
if (entry.links?.discord?.length) {
const discordGroupElement = baseGroupElement.cloneNode()
linkListElement.appendChild(discordGroupElement)
@ -147,7 +147,7 @@ function createInfoBlock(entry, isPreview) {
})
}
if (entry.links.wiki?.length) {
if (entry.links?.wiki?.length) {
const wikiGroupElement = baseGroupElement.cloneNode()
linkListElement.appendChild(wikiGroupElement)

View file

@ -333,7 +333,7 @@ function buildObjectsList(filter, sort = defaultSort) {
atlasDisplay = atlas.filter(entry => {
return (
entry.name.toLowerCase().includes(filter.toLowerCase())
|| entry.description.toLowerCase().includes(filter.toLowerCase())
|| entry.description?.toLowerCase().includes(filter.toLowerCase())
|| Object.values(entry.links).flat().some(str => str.toLowerCase().includes(filter))
|| entry.id === filter
)