Skip to content

Commit

Permalink
fix: prevent display of 0 if tags array in README.md is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
herteleo committed Mar 11, 2023
1 parent 177748c commit 5498a47
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/features/useDir.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ export const setupDirEntries = async (dir: FileSystemDirectoryHandle) => {
} else {
const { frontmatter = {} } = (await resolveReadmeData(entry))?.parsed || {};
const { tags } = frontmatter;
const readmeTags = Array.isArray(tags) ? tags.map((t) => String(t)) : [];
const readmeTags = Array.isArray(tags) ? tags.filter(Boolean).map((t) => String(t)) : [];

entries.push({
handle: entry,
Expand Down
2 changes: 1 addition & 1 deletion src/views/Dir.vue
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ const { trigger: triggerCurrentDirWatcher } = watchTriggerable(
const { tags } = frontmatter;
readmeContent.value = marked.parse(content || '', { headerIds: false, renderer });
readmeTags.value = Array.isArray(tags) ? tags.map((t) => String(t)) : [];
readmeTags.value = Array.isArray(tags) ? tags.filter(Boolean).map((t) => String(t)) : [];
},
{ immediate: true }
);
Expand Down

0 comments on commit 5498a47

Please sign in to comment.