createEffect(() => {
if (observer) {
observer.disconnect();
}
const options = {
root: document.querySelector("#notificationsArea"),
rootMargin: "0px",
threshold: 1.0,
};
const callback = (entries) => {
entries.forEach((entry) => {
if (entry.isIntersecting) {
fetchData();
if (observer) {
observer.unobserve(entry.target);
}
}
});
};
observer = new IntersectionObserver(callback, options);
if (notifications().length) {
const newLastNotification = notifications()[notifications().length - 1];
if (lastNotification && newLastNotification.id !== lastNotification.id) {
lastNotification.id = newLastNotification.id;
lastNotification.created_at = newLastNotification.created_at;
const target = document.querySelector(
createEffect(() => {
if (observer) {
observer.disconnect();
}
const options = {
root: document.querySelector("#notificationsArea"),
rootMargin: "0px",
threshold: 1.0,
};
const callback = (entries) => {
entries.forEach((entry) => {
if (entry.isIntersecting) {
fetchData();
if (observer) {
observer.unobserve(entry.target);
}
}
});
};
observer = new IntersectionObserver(callback, options);
if (notifications().length) {
const newLastNotification = notifications()[notifications().length - 1];
if (lastNotification && newLastNotification.id !== lastNotification.id) {
lastNotification.id = newLastNotification.id;
lastNotification.created_at = newLastNotification.created_at;
const target = document.querySelector(