photobooth funktionen im event admin verlinkt, gäste pwa zeigt photobooth nur noch an, wenn diese aktiviert ist. kontaktformular optimiert. teilen-link mit iMessage und whatsapp erweitert.
This commit is contained in:
@@ -64,17 +64,22 @@ export function usePollGalleryDelta(token: string, locale: LocaleCode) {
|
||||
|
||||
if (newPhotos.length > 0) {
|
||||
const added = newPhotos.length;
|
||||
|
||||
if (latestAt.current) {
|
||||
// Delta mode: Add new photos to existing list
|
||||
const merged = [...newPhotos, ...photos];
|
||||
const byId = new Map<number, Photo>();
|
||||
merged.forEach((photo) => byId.set(photo.id, photo));
|
||||
setPhotos(Array.from(byId.values()));
|
||||
if (added > 0) setNewCount((c) => c + added);
|
||||
} else {
|
||||
// Initial load: Set all photos
|
||||
setPhotos(newPhotos);
|
||||
const hasBaseline = latestAt.current !== null;
|
||||
|
||||
setPhotos((prev) => {
|
||||
if (hasBaseline) {
|
||||
// Delta mode: merge new photos with existing list by id
|
||||
const merged = [...newPhotos, ...prev];
|
||||
const byId = new Map<number, Photo>();
|
||||
merged.forEach((photo) => byId.set(photo.id, photo));
|
||||
return Array.from(byId.values());
|
||||
}
|
||||
|
||||
return newPhotos;
|
||||
});
|
||||
|
||||
if (hasBaseline && added > 0) {
|
||||
setNewCount((c) => c + added);
|
||||
}
|
||||
|
||||
// Update latest timestamp
|
||||
@@ -103,7 +108,7 @@ export function usePollGalleryDelta(token: string, locale: LocaleCode) {
|
||||
setLoading(false);
|
||||
// Don't update state on error - keep previous photos
|
||||
}
|
||||
}, [locale, photos, token]);
|
||||
}, [locale, token]);
|
||||
|
||||
useEffect(() => {
|
||||
const onVis = () => setVisible(document.visibilityState === 'visible');
|
||||
|
||||
Reference in New Issue
Block a user