diff --git a/apps/website/src/routes/(site)/photos/+page.svelte b/apps/website/src/routes/(site)/photos/+page.svelte index 0c640f0..b02d975 100644 --- a/apps/website/src/routes/(site)/photos/+page.svelte +++ b/apps/website/src/routes/(site)/photos/+page.svelte @@ -197,12 +197,13 @@ // Workaround: Reactive photos based on data $effect(() => { - if (data.photos && data.photos !== photos) { + if (data.photos) { photos = data.photos } }) - $effect(() => { + + onMount(() => { /** * Observers */ @@ -237,17 +238,6 @@ const existingPhotos = photosGridEl.querySelectorAll('.photo') existingPhotos.forEach(el => observerPhotos.observe(el)) - - // Destroy - return () => { - // Disconnect observers - observerPhotos && observerPhotos.disconnect() - mutationPhotos && mutationPhotos.disconnect() - } - }) - - - onMount(() => { /** * Animations */ @@ -271,6 +261,13 @@ // Run animation requestAnimationFrame(animation.play) + + // Destroy + return () => { + // Disconnect observers + observerPhotos && observerPhotos.disconnect() + mutationPhotos && mutationPhotos.disconnect() + } })