fix(photo-wall): clear stale photos + revoke object URLs before (re)loading

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
cc 2026-06-24 21:27:24 +08:00
parent a9905b4fa7
commit dba517df4e

View File

@ -283,6 +283,10 @@ export function PhotoWallPage({ onExit, token }: PhotoWallPageProps) {
let alive = true let alive = true
;(async () => { ;(async () => {
try { try {
// 重新加载前清掉旧会话的照片,避免重复堆叠与 objectURL 泄漏
for (const u of objUrls.current) URL.revokeObjectURL(u)
objUrls.current = []
setEls((prev) => prev.filter((e) => e.type !== 'photo'))
const { items } = await listPhotos(token) const { items } = await listPhotos(token)
for (const item of items) { for (const item of items) {
let url: string let url: string