feat: Suspense boundary architecture for multi-domain data fetching#94
Merged
elizabetheonoja-art merged 1 commit intoJun 26, 2026
Conversation
…tility-Protocol#63) Coordinates the four data domains (blockchain, telemetry, metadata, spatial) behind named Suspense boundaries with stale-while-revalidate caching and a fallback cascade. - types/suspense.ts: DomainKey, per-domain Suspense timeouts (10/3/5/8s) and cache TTLs (30/5/120/300s), CacheEntry, SuspenseResource, cache-group helpers - store/slices/cacheSlice.ts: per-key entries with fetched-at/TTL, isFresh/ isStale, CACHE_UPDATED/PENDING/REJECTED, and group + single-key invalidation - utils/suspenseResource.ts: createResource(read/prefetch/invalidate/peek) — throw-promise pattern with SWR (fresh→data, stale→data+background revalidate, missing→suspend, rejected→throw), de-duplicated in-flight fetches - hooks/useSuspenseResource.ts: reads a resource and re-renders on cache updates - components/boundaries: ErrorBoundary, domain skeletons, ErrorPanel, the generic DomainBoundary (Retry → invalidate groups + remount), the four primary boundaries, the dashboard/map composites, and a CascadeProvider/CascadeGate for the fallback cascade - components/dashboard/DashboardPage.tsx: composes the boundaries (component, not src/pages, since this is an App Router project) - services/soroban.ts: adds promise-based readContractState for Suspense wrapping - tests for the cache store, the resource factory (suspend/SWR/reject/invalidate/ dedup), and RTL boundary behaviour (fallback->content, error+retry, cascade)
elizabetheonoja-art
approved these changes
Jun 26, 2026
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.
React Concurrent Suspense Boundary Architecture for Multi-Domain Data Fetching (#63)
Closes #63
What's included
src/types/suspense.tsDomainKey, per-domain Suspense timeouts (10/3/5/8 s) and cache TTLs (30/5/120/300 s),CacheEntry,SuspenseResource, and cache-group helpers.src/store/slices/cacheSlice.tsfetchedAt/ttlMs,isFresh/isStale,CACHE_UPDATED/PENDING/REJECTED, and group + single-key invalidation.src/utils/suspenseResource.tscreateResource(read/prefetch/invalidate/peek)— the throw-promise pattern with SWR: fresh → data, stale → data + background revalidate (no suspend), missing → suspend, rejected → throw. In-flight fetches de-duplicated per key.src/hooks/useSuspenseResource.tssrc/components/boundaries/*ErrorBoundary, domainSkeletonLoaders,ErrorPanel, the genericDomainBoundary(Retry → invalidate groups + remount via key bump), the four primary boundaries, theDashboard/Mapcomposites, andCascadeProvider/CascadeGate.src/components/dashboard/DashboardPage.tsxsrc/services/soroban.tsreadContractStatefor Suspense wrapping.tests/unit/*+tests/components/boundaries.test.tsx