fix: Duplicate icon display error

#719
This commit is contained in:
MystiPanda 2024-03-21 20:29:16 +08:00
parent b3ffcd020f
commit c200e18434
2 changed files with 4 additions and 3 deletions

View File

@ -49,7 +49,8 @@ export const ProxyRender = (props: RenderProps) => {
async function initIconCachePath() { async function initIconCachePath() {
if (group.icon && group.icon.trim().startsWith("http")) { if (group.icon && group.icon.trim().startsWith("http")) {
const fileName = getFileName(group.icon); const fileName =
group.name.replaceAll(" ", "") + "-" + getFileName(group.icon);
const iconPath = await downloadIconCache(group.icon, fileName); const iconPath = await downloadIconCache(group.icon, fileName);
setIconCachePath(convertFileSrc(iconPath)); setIconCachePath(convertFileSrc(iconPath));
} }

View File

@ -18,7 +18,7 @@ import { Notice } from "@/components/base";
import { TestBox } from "./test-box"; import { TestBox } from "./test-box";
import delayManager from "@/services/delay"; import delayManager from "@/services/delay";
import { cmdTestDelay, downloadIconCache } from "@/services/cmds"; import { cmdTestDelay, downloadIconCache } from "@/services/cmds";
import { listen, Event, UnlistenFn } from "@tauri-apps/api/event"; import { listen, UnlistenFn } from "@tauri-apps/api/event";
import { convertFileSrc } from "@tauri-apps/api/tauri"; import { convertFileSrc } from "@tauri-apps/api/tauri";
interface Props { interface Props {
@ -48,7 +48,7 @@ export const TestItem = (props: Props) => {
async function initIconCachePath() { async function initIconCachePath() {
if (icon && icon.trim().startsWith("http")) { if (icon && icon.trim().startsWith("http")) {
const fileName = getFileName(icon); const fileName = uid + "-" + getFileName(icon);
const iconPath = await downloadIconCache(icon, fileName); const iconPath = await downloadIconCache(icon, fileName);
setIconCachePath(convertFileSrc(iconPath)); setIconCachePath(convertFileSrc(iconPath));
} }