Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENG-194 Fixed the issue with fetching the DAO info #2717

Merged
merged 4 commits into from
Feb 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/pages/create/SafeCreatePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export function SafeCreatePage() {
if (daoFound) {
navigate(DAO_ROUTES.dao.relative(addressPrefix, safeAddress));
} else {
toast.loading(t('failedIndexSafe'));
toast.info(t('failedIndexSafe'), { duration: Infinity });
navigate(BASE_ROUTES.landing);
}
},
Expand Down
15 changes: 12 additions & 3 deletions src/providers/App/hooks/useSafeAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,18 @@ class EnhancedSafeApiKit extends SafeApiKit {
call = endpoint();
this.requestMap.set(cacheKey, call);
}
value = await call;
this.requestMap.set(cacheKey, null);
await this.setCache(cacheKey, value, cacheMinutes);
try {
value = await call;
this.requestMap.set(cacheKey, null);
await this.setCache(cacheKey, value, cacheMinutes);
} catch (error) {
/*
await call can throw an exception with the Promise being rejected
Without resetting the cache, the same promise will be used in retrials and always throw an exception
*/
this.requestMap.set(cacheKey, null);
throw error;
}
}
return value;
}
Expand Down