Skip to content

armgit / memos

Public Imported from GitHub
0

Memos is an open-source, self-hosted note-taking app that brings your everyday thoughts together in a personal timeline. Your data stays yours, and you choose what to keep private or share.

fix: tag stats

Steven012ca1d78090
diff --git a/web/src/store/v1/memoMetadata.ts b/web/src/store/v1/memoMetadata.ts
index 3bc2bfaf3..ec39921a6 100644
--- a/web/src/store/v1/memoMetadata.ts
+++ b/web/src/store/v1/memoMetadata.ts
@@ -59,12 +59,17 @@ export const useMemoTagList = () => {
const memos = Object.values(memoStore.getState().dataMapByName);
const tagAmounts: Record<string, number> = {};
memos.forEach((memo) => {
- memo.tags.forEach((tag) => {
- if (tagAmounts[tag]) {
- tagAmounts[tag] += 1;
- } else {
- tagAmounts[tag] = 1;
+ const tagSet = new Set<string>();
+ for (const tag of memo.tags) {
+ const parts = tag.split("/");
+ let currentTag = "";
+ for (const part of parts) {
+ currentTag = currentTag ? `${currentTag}/${part}` : part;
+ tagSet.add(currentTag);
}
+ }
+ Array.from(tagSet).forEach((tag) => {
+ tagAmounts[tag] = tagAmounts[tag] ? tagAmounts[tag] + 1 : 1;
});
});
return tagAmounts;