fix(frontend): reliability — timeout, 5xx retry, promise rejection handling, cache invalidation#1023
Merged
Merged
Conversation
… state Adds void to the floating promise call in useEffect to make the async intent explicit and prevent ESLint no-floating-promises warnings. Adds tests verifying that promise rejections set the error state accessible from the hook return value, and that non-Error rejections are normalized into proper Error objects. closes solutions-plug#944
Adds a tags field to cache entries and an invalidateByTags() method so mutations can drop only the affected resource namespaces instead of wiping the entire cache. Cache TTL time-based expiry is retained as the fallback for entries that are never explicitly invalidated. closes solutions-plug#947
…che invalidation Timeout (solutions-plug#945): each fetch attempt is wrapped in a 10-second AbortController timer. If it fires, an ApiError with code TIMEOUT_ERROR is thrown so callers can surface a message distinct from generic network errors. 5xx retry (solutions-plug#946): GET (and explicitly idempotent) requests are retried up to maxRetries times on transient 5xx responses with exponential back-off and jitter. POST/DELETE are never retried unless marked idempotent. Cache invalidation (solutions-plug#947): GET endpoints now record resource tags when caching. Mutations use invalidateByTags() to drop only the affected namespaces instead of clearing the entire cache with the catch-all pattern. closes solutions-plug#945 closes solutions-plug#946 closes solutions-plug#947
|
@abore9769 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
useAsyncnow makes the floating promise explicit (void execute()), and tests verify bothErrorand non-Errorrejections are caught and exposed via the hook'serrorreturn value.client.tsis wrapped in a 10-secondAbortControllertimeout. A distinctTIMEOUT_ERRORcode is thrown so the UI can surface a message separate from generic network failures.GET(and explicitlyidempotent-flagged) requests are now retried on transient5xxresponses, up tomaxRetriestimes with exponential back-off and jitter.POST/DELETEare never retried unless opted in.statistics,markets,blockchain,newsletter,email). Mutations callinvalidateByTags()to drop only the affected entries instead of clearing the entire cache.Test plan
npm testpasses infrontend/with all 57 unit tests greenjest.useFakeTimers()/advanceTimersByTimeAsync— no real 10-second waitcloses #944
closes #945
closes #946
closes #947