From 223031866b4236a4ae11479a34395bdbde38329a Mon Sep 17 00:00:00 2001 From: Jose Olarte III Date: Mon, 17 Nov 2025 19:58:55 +0800 Subject: [PATCH] refactor: remove unused loadMoreCallback prop from EntityGrid Remove loadMoreCallback prop and related backward compatibility code. No parent components were using this prop, and it has been superseded by the internal pagination mechanism using fetchProjects() and beforeId. --- src/components/EntityGrid.vue | 46 ----------------------------------- 1 file changed, 46 deletions(-) diff --git a/src/components/EntityGrid.vue b/src/components/EntityGrid.vue index c2ae4fde82..1a964d8c3d 100644 --- a/src/components/EntityGrid.vue +++ b/src/components/EntityGrid.vue @@ -222,7 +222,6 @@ export default class EntityGrid extends Vue { displayedCount = INITIAL_BATCH_SIZE; infiniteScrollReset?: () => void; scrollContainer?: HTMLElement; - isLoadingMore = false; // Prevent duplicate callback calls /** * Array of entities to display @@ -302,23 +301,6 @@ export default class EntityGrid extends Vue { entityType: "people" | "projects", ) => Contact[] | PlanData[]; - /** - * Optional callback function to load more entities from server - * Called when infinite scroll reaches end and more data is available - * Required for projects when using server-side pagination - * - * @param entities - Current array of entities - * @returns Promise that resolves when more entities are loaded - * - * @example - * :load-more-callback="async (entities) => { - * const lastEntity = entities[entities.length - 1]; - * await loadMoreFromServer(lastEntity.rowId); - * }" - */ - @Prop({ default: null }) - loadMoreCallback?: (entities: Contact[] | PlanData[]) => Promise; - /** * CSS classes for the empty state message */ @@ -807,15 +789,6 @@ export default class EntityGrid extends Vue { !!beforeId && !this.isLoadingProjects; - // Also check if loadMoreCallback is provided (for backward compatibility) - if ( - this.entities && - this.displayedCount >= this.entities.length && - this.loadMoreCallback - ) { - return !this.isLoadingMore; - } - return hasMoreLoaded || canLoadMoreFromServer; } @@ -928,25 +901,6 @@ export default class EntityGrid extends Vue { } finally { this.isLoadingProjects = false; } - } else if ( - this.entities && - this.displayedCount >= this.entities.length && - this.loadMoreCallback && - !this.isLoadingMore - ) { - // Backward compatibility: use loadMoreCallback if provided - this.isLoadingMore = true; - try { - await this.loadMoreCallback(this.entities); - // After callback, entities prop will update via Vue reactivity - // Reset scroll state to allow further loading - this.infiniteScrollReset?.(); - } catch (error) { - // Error handling is up to the callback, but we should reset loading state - logger.error("Error in loadMoreCallback:", error); - } finally { - this.isLoadingMore = false; - } } else { // Normal case: increment displayedCount to show more from memory this.displayedCount += INCREMENT_SIZE;