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.
This commit is contained in:
Jose Olarte III
2025-11-17 19:58:55 +08:00
parent cb75b25529
commit 223031866b

View File

@@ -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<void>;
/**
* 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;