fix: exceeded effect on Photos page?
This commit is contained in:
@@ -197,12 +197,13 @@
|
|||||||
|
|
||||||
// Workaround: Reactive photos based on data
|
// Workaround: Reactive photos based on data
|
||||||
$effect(() => {
|
$effect(() => {
|
||||||
if (data.photos && data.photos !== photos) {
|
if (data.photos) {
|
||||||
photos = data.photos
|
photos = data.photos
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
$effect(() => {
|
|
||||||
|
onMount(() => {
|
||||||
/**
|
/**
|
||||||
* Observers
|
* Observers
|
||||||
*/
|
*/
|
||||||
@@ -237,17 +238,6 @@
|
|||||||
const existingPhotos = photosGridEl.querySelectorAll('.photo')
|
const existingPhotos = photosGridEl.querySelectorAll('.photo')
|
||||||
existingPhotos.forEach(el => observerPhotos.observe(el))
|
existingPhotos.forEach(el => observerPhotos.observe(el))
|
||||||
|
|
||||||
|
|
||||||
// Destroy
|
|
||||||
return () => {
|
|
||||||
// Disconnect observers
|
|
||||||
observerPhotos && observerPhotos.disconnect()
|
|
||||||
mutationPhotos && mutationPhotos.disconnect()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
onMount(() => {
|
|
||||||
/**
|
/**
|
||||||
* Animations
|
* Animations
|
||||||
*/
|
*/
|
||||||
@@ -271,6 +261,13 @@
|
|||||||
|
|
||||||
// Run animation
|
// Run animation
|
||||||
requestAnimationFrame(animation.play)
|
requestAnimationFrame(animation.play)
|
||||||
|
|
||||||
|
// Destroy
|
||||||
|
return () => {
|
||||||
|
// Disconnect observers
|
||||||
|
observerPhotos && observerPhotos.disconnect()
|
||||||
|
mutationPhotos && mutationPhotos.disconnect()
|
||||||
|
}
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user