fix(photo-wall): preserve saved layouts during async photo load (merge, not replace)
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
f88686cd21
commit
624b5eb284
@ -229,7 +229,9 @@ export function PhotoWallPage({ onExit, token }: PhotoWallPageProps) {
|
|||||||
const t = setTimeout(() => {
|
const t = setTimeout(() => {
|
||||||
try {
|
try {
|
||||||
const decorations = els.filter((e) => e.type !== 'photo')
|
const decorations = els.filter((e) => e.type !== 'photo')
|
||||||
const photoLayout: Record<string, PhotoLayout> = {}
|
// 从已知排版起步而非清空:未加载完/取图失败的照片其排版得以保留,
|
||||||
|
// 已加载或移动过的照片在下面覆盖各自的 key(删除时 removeEl 已从 layoutRef 删键)。
|
||||||
|
const photoLayout: Record<string, PhotoLayout> = { ...layoutRef.current }
|
||||||
for (const e of els) {
|
for (const e of els) {
|
||||||
if (e.type === 'photo' && e.photoId) {
|
if (e.type === 'photo' && e.photoId) {
|
||||||
photoLayout[e.photoId] = {
|
photoLayout[e.photoId] = {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user