From 149703a5dfd31bed3cec58555445a701d2982a2e Mon Sep 17 00:00:00 2001 From: Elio Struyf Date: Wed, 13 Jul 2022 13:52:06 +0200 Subject: [PATCH] Fix for tags rendering on content cards --- CHANGELOG.md | 12 +++--------- .../components/Contents/Item.tsx | 17 ++++++++++------- 2 files changed, 13 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 312f9f5a..02c288dc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,18 +1,12 @@ # Change Log -## [8.1.0] - 2022-xx-xx - -### ✨ New features - -### 🎨 Enhancements - -- Fix `PSD` media card icon image - -### ⚡️ Optimizations +## [8.0.1] - 2022-07-13 ### 🐞 Fixes +- Fix `PSD` media card icon image - Fix missing clipboard icon for the media card action +- Fix in tags rendering on content cards ## [8.0.0] - 2022-07-11 - [Release notes](https://beta.frontmatter.codes/updates/v8.0.0) diff --git a/src/dashboardWebView/components/Contents/Item.tsx b/src/dashboardWebView/components/Contents/Item.tsx index 6fa68cd0..0991241d 100644 --- a/src/dashboardWebView/components/Contents/Item.tsx +++ b/src/dashboardWebView/components/Contents/Item.tsx @@ -30,20 +30,23 @@ export const Item: React.FunctionComponent = ({ fmFilePath, date, ti } const tagField = settings.dashboardState.contents.tags; + let tagsValue = []; if (tagField === "tags") { - return pageData.fmTags; + tagsValue = pageData.fmTags; } else if (tagField === "categories") { - return pageData.fmCategories; + tagsValue = pageData.fmCategories; + } else { + tagsValue = pageData[tagField] || []; } - const tagsValue = pageData[tagField] || []; - - if (Array.isArray(tagsValue)) { + if (typeof tagsValue === "string") { + return [tagsValue]; + } else if (Array.isArray(tagsValue)) { return tagsValue; } - return [tagsValue]; + return []; }, [settings, pageData]); if (view === DashboardViewType.Grid) { @@ -119,4 +122,4 @@ export const Item: React.FunctionComponent = ({ fmFilePath, date, ti } return null; -}; +}; \ No newline at end of file