Compare commits
1 Commits
meeting-pr
...
address-du
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
944f5bc224 |
@@ -536,6 +536,14 @@ export default class DiscoverView extends Vue {
|
||||
}
|
||||
|
||||
public async searchAll(beforeId?: string) {
|
||||
// Guard against concurrent calls (allow pagination concurrent calls)
|
||||
if (this.isLoading && !beforeId) {
|
||||
logger.debug(
|
||||
"[DiscoverView] ⚠️ searchAll() already in progress, skipping",
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
this.resetCounts();
|
||||
|
||||
if (!beforeId) {
|
||||
@@ -601,6 +609,14 @@ export default class DiscoverView extends Vue {
|
||||
}
|
||||
|
||||
public async searchStarred() {
|
||||
// Guard against concurrent calls
|
||||
if (this.isLoading) {
|
||||
logger.debug(
|
||||
"[DiscoverView] ⚠️ searchStarred() already in progress, skipping",
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
this.resetCounts();
|
||||
|
||||
// Clear any previous results
|
||||
|
||||
@@ -1091,17 +1091,27 @@ export default class HomeView extends Vue {
|
||||
* - this.feedData (via processFeedResults)
|
||||
* - this.feedLastViewedClaimId (via updateFeedLastViewedId)
|
||||
*/
|
||||
async updateAllFeed() {
|
||||
async updateAllFeed(retryCount: number = 0) {
|
||||
// Guard against concurrent calls (but allow retries)
|
||||
if (this.isFeedLoading && retryCount === 0) {
|
||||
logger.debug(
|
||||
"[HomeView] ⚠️ updateAllFeed() already in progress, skipping",
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
logger.debug("[HomeView] 🚀 updateAllFeed() called", {
|
||||
isFeedLoading: this.isFeedLoading,
|
||||
currentFeedDataLength: this.feedData.length,
|
||||
isAnyFeedFilterOn: this.isAnyFeedFilterOn,
|
||||
isFeedFilteredByVisible: this.isFeedFilteredByVisible,
|
||||
isFeedFilteredByNearby: this.isFeedFilteredByNearby,
|
||||
retryCount,
|
||||
});
|
||||
|
||||
this.isFeedLoading = true;
|
||||
let endOfResults = true;
|
||||
const MAX_RETRIES = 5; // Prevent infinite recursion
|
||||
|
||||
try {
|
||||
const results = await this.retrieveGives(
|
||||
@@ -1127,11 +1137,24 @@ export default class HomeView extends Vue {
|
||||
} catch (e) {
|
||||
logger.error("[HomeView] ❌ Error in updateAllFeed:", e);
|
||||
this.handleFeedError(e);
|
||||
// Don't retry on error
|
||||
endOfResults = true;
|
||||
}
|
||||
|
||||
if (this.feedData.length === 0 && !endOfResults) {
|
||||
logger.debug("[HomeView] 🔄 No results after filtering, retrying...");
|
||||
await this.updateAllFeed();
|
||||
// Fixed recursive retry with guard and retry count
|
||||
if (
|
||||
this.feedData.length === 0 &&
|
||||
!endOfResults &&
|
||||
retryCount < MAX_RETRIES
|
||||
) {
|
||||
logger.debug("[HomeView] 🔄 No results after filtering, retrying...", {
|
||||
retryCount: retryCount + 1,
|
||||
maxRetries: MAX_RETRIES,
|
||||
});
|
||||
// Temporarily clear loading flag for recursive call
|
||||
this.isFeedLoading = false;
|
||||
await this.updateAllFeed(retryCount + 1);
|
||||
return; // Exit after recursive call
|
||||
}
|
||||
|
||||
this.isFeedLoading = false;
|
||||
|
||||
Reference in New Issue
Block a user