🐛 优化脚本图标展示 #1052 by CodFrm · Pull Request #1104 · scriptscat/scriptcat

@CodFrm

概述 Descriptions

close #1052

变更内容 Changes

截图 Screenshots

@CodFrm

@CodFrm

cyfung1031

{...rest}
>
{icon && !imageError ? (
<img title={match} src={icon} onError={() => setImageError(true)} />

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不是在 fetchIcon 已经能知道是失败还是成功吗
不然怎储在OPFS?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

确实如此,可以删了这个逻辑

@CodFrm

CodFrm

Comment on lines -228 to -233

try {
const sessionBlobUrl = await cacheInstance.get<string>(`${CACHE_KEY_FAVICON}${filename}`);
if (sessionBlobUrl) return sessionBlobUrl;
} catch {
// 即使报错也不影响
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cyfung1031 这里是运行在option页面上的,刷新option页面,会释放掉,这里用了缓存第二次会返回无效的链接

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

原來如此

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

那就不cache每次都取opfs 做bloburl吧