fix logic infinity
This commit is contained in:
@@ -204,6 +204,7 @@ function shouldBeLarge(index: number, columns: number): boolean {
|
||||
private endCursor: string | null = null;
|
||||
private currentIndex: number;
|
||||
private gridColumns: 3 | 4 = 4;
|
||||
private loadMoreConfig: any;
|
||||
|
||||
// Константы для разных сеток
|
||||
private readonly CYCLE_LENGTH = {
|
||||
@@ -228,6 +229,12 @@ function shouldBeLarge(index: number, columns: number): boolean {
|
||||
this.endCursor = this.sentinel.dataset.endCursor || null;
|
||||
this.currentIndex = parseInt(this.sentinel.dataset.currentIndex || '0');
|
||||
this.gridColumns = parseInt(this.sentinel.dataset.gridColumns || '4') as 3 | 4;
|
||||
|
||||
try {
|
||||
this.loadMoreConfig = JSON.parse(this.sentinel.dataset.loadConfig || '{}');
|
||||
} catch {
|
||||
this.loadMoreConfig = { type: 'latest', slug: '', gridColumns: this.gridColumns };
|
||||
}
|
||||
|
||||
this.init();
|
||||
}
|
||||
@@ -398,4 +405,9 @@ function shouldBeLarge(index: number, columns: number): boolean {
|
||||
}, 200);
|
||||
}
|
||||
}
|
||||
|
||||
// Очистка при навигации Astro
|
||||
document.addEventListener('astro:before-swap', () => {
|
||||
// Здесь можно добавить логику очистки если нужно
|
||||
});
|
||||
</script>
|
||||
Reference in New Issue
Block a user