Fix filter issue, cause by empty attributes

This commit is contained in:
Alicia Sykes 2019-09-28 15:35:54 +01:00
parent 9e44dc8160
commit 581c60f41a

View File

@ -56,10 +56,14 @@ export default {
},
filterTiles(allTiles) {
return allTiles.filter((tile) => {
const {
title, description, provider, url,
} = tile;
const searchTerm = this.searchTile.toLowerCase();
return tile.title.toLowerCase().includes(searchTerm)
|| tile.provider.toLowerCase().includes(searchTerm)
|| this.getDomainFromUrl(tile.url).includes(searchTerm);
return (title && title.toLowerCase().includes(searchTerm))
|| (provider && provider.toLowerCase().includes(searchTerm))
|| (description && description.toLowerCase().includes(searchTerm))
|| this.getDomainFromUrl(url).includes(searchTerm);
});
},
},