Profile hover cards

This commit is contained in:
2023-10-09 16:32:14 +01:00
parent b62b877f5a
commit 8d882a0844
16 changed files with 184 additions and 75 deletions

View File

@ -3,11 +3,14 @@ import { ParsedFragment, transformText } from "@snort/system";
const TextCache = new Map<string, Array<ParsedFragment>>();
export function transformTextCached(id: string, content: string, tags: Array<Array<string>>) {
const cached = TextCache.get(id);
if (cached) return cached;
const newCache = transformText(content, tags);
TextCache.set(id, newCache);
return newCache;
if (content.length > 0) {
const cached = TextCache.get(id);
if (cached) return cached;
const newCache = transformText(content, tags);
TextCache.set(id, newCache);
return newCache;
}
return [];
}
export function useTextTransformer(id: string, content: string, tags: Array<Array<string>>) {