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) {
|
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();
|
this.resetCounts();
|
||||||
|
|
||||||
if (!beforeId) {
|
if (!beforeId) {
|
||||||
@@ -601,6 +609,14 @@ export default class DiscoverView extends Vue {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public async searchStarred() {
|
public async searchStarred() {
|
||||||
|
// Guard against concurrent calls
|
||||||
|
if (this.isLoading) {
|
||||||
|
logger.debug(
|
||||||
|
"[DiscoverView] ⚠️ searchStarred() already in progress, skipping",
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this.resetCounts();
|
this.resetCounts();
|
||||||
|
|
||||||
// Clear any previous results
|
// Clear any previous results
|
||||||
|
|||||||
@@ -1091,17 +1091,27 @@ export default class HomeView extends Vue {
|
|||||||
* - this.feedData (via processFeedResults)
|
* - this.feedData (via processFeedResults)
|
||||||
* - this.feedLastViewedClaimId (via updateFeedLastViewedId)
|
* - 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", {
|
logger.debug("[HomeView] 🚀 updateAllFeed() called", {
|
||||||
isFeedLoading: this.isFeedLoading,
|
isFeedLoading: this.isFeedLoading,
|
||||||
currentFeedDataLength: this.feedData.length,
|
currentFeedDataLength: this.feedData.length,
|
||||||
isAnyFeedFilterOn: this.isAnyFeedFilterOn,
|
isAnyFeedFilterOn: this.isAnyFeedFilterOn,
|
||||||
isFeedFilteredByVisible: this.isFeedFilteredByVisible,
|
isFeedFilteredByVisible: this.isFeedFilteredByVisible,
|
||||||
isFeedFilteredByNearby: this.isFeedFilteredByNearby,
|
isFeedFilteredByNearby: this.isFeedFilteredByNearby,
|
||||||
|
retryCount,
|
||||||
});
|
});
|
||||||
|
|
||||||
this.isFeedLoading = true;
|
this.isFeedLoading = true;
|
||||||
let endOfResults = true;
|
let endOfResults = true;
|
||||||
|
const MAX_RETRIES = 5; // Prevent infinite recursion
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const results = await this.retrieveGives(
|
const results = await this.retrieveGives(
|
||||||
@@ -1127,11 +1137,24 @@ export default class HomeView extends Vue {
|
|||||||
} catch (e) {
|
} catch (e) {
|
||||||
logger.error("[HomeView] ❌ Error in updateAllFeed:", e);
|
logger.error("[HomeView] ❌ Error in updateAllFeed:", e);
|
||||||
this.handleFeedError(e);
|
this.handleFeedError(e);
|
||||||
|
// Don't retry on error
|
||||||
|
endOfResults = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.feedData.length === 0 && !endOfResults) {
|
// Fixed recursive retry with guard and retry count
|
||||||
logger.debug("[HomeView] 🔄 No results after filtering, retrying...");
|
if (
|
||||||
await this.updateAllFeed();
|
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;
|
this.isFeedLoading = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user