Skip to content

Commit 289bf06

Browse files
authored
Filter out empty tag names in fetchTopTags function to ensure only valid tags are returned. (#2828)
1 parent 56ef362 commit 289bf06

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/services/Challenge/TopTags.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ export const fetchTopTags = function (challengeId) {
1212
.execute()
1313
.then((response) => {
1414
// The API returns an object with numeric keys, convert to array
15-
return response?.result ? Object.values(response.result) : [];
15+
return response?.result
16+
? Object.values(response.result).filter((tag) => tag.name && tag.name.trim() !== "")
17+
: [];
1618
})
1719
.catch((error) => {
1820
console.log(error.response || error);

0 commit comments

Comments
 (0)