fix: exceeded effect on Photos page?
This commit is contained in:
@@ -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()
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user