-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Alpine Expression Error: signal is aborted without reason - After Intensive Infinite Scrolling #90
Comments
to fix your trouble try download this fix, i see it in another issue, |
1 similar comment
to fix your trouble try download this fix, i see it in another issue, |
Hmm, this might be caused by scrolling too fast. We recently introduced some code that will abort any pending requests for an element before the same element makes a new request. |
Yeah, it's probably that. However, I realized that I don't need alpine-ajax for this project and can simply implement infinite scroll using Alpine.js and Fetch. Here’s the code. I hope this helps someone. Alpine.data('infiniteScroll', () => ({
isLoading: false,
loadMore(url) {
const paginationDiv = document.getElementById('js-pagination');
const loadingDiv = document.getElementById('js-infinite-loading');
if (this.isLoading) return; // Prevent multiple requests
this.isLoading = true;
loadingDiv.style.display = 'flex';
fetch(url)
.then(response => {
if (!response.ok) {
throw new Error(`HTTP error! Status: ${response.status}`);
}
return response.text();
})
.then(html => {
const parser = new DOMParser();
const doc = parser.parseFromString(html, 'text/html');
const newItems = doc.querySelector('#js-items');
if (newItems) {
document.getElementById('js-items').insertAdjacentHTML('beforeend', newItems.innerHTML);
const newPagination = doc.querySelector('#js-pagination');
if (newPagination) {
paginationDiv.replaceWith(newPagination);
} else {
paginationDiv.remove();
}
} else {
console.error('Error: #js-items element not found in the response.');
}
})
.catch(error => console.error('Error loading more items:', error))
.finally(() => {
this.isLoading = false;
loadingDiv.style.display = 'none';
if (typeof masonryInstance !== 'undefined') {
masonryInstance.layout();
}
});
}
})); |
I'm also hitting this error, but not with infinite scrolling, just regular component loading (it works the first few times when I open the page, but then stops working after a few clicks: Alpine Expression Error: signal is aborted without reason
Expression: "$ajax('body/', { body: { ...queryParams } })" index/the-page/ <SomeAstroComponent
id="some-id"
class="hidden"
x-init="$ajax('body/', { body: { ...queryParams } })"
/> index/The context is an Unpoly up-target that dynamically updates the dom with the contents of a page when clicked. <a
href="the-page/"
up-target="#debug-body"
up-history
>Click this to insert the-page/ into the current page's debug-body</a> This is part of a test to see whether unpoly and alpine can be used in the same project. I suspect that when Unpoly inserts |
Alrighty, I can reproduce this error now. Working on a fix! |
Thanks @imacrayon! |
Hey!
I'm encountering an error after implementing infinite scrolling. After several scroll events, the console shows the following error:
Implementation Details
Main view:
Load more view:
Any help or insights into this issue? Thanks!
The text was updated successfully, but these errors were encountered: