feat/skeletons-async-interval-hooks-request-dedup - #402
Merged
DeFiVC merged 1 commit intoAug 31, 2026
Merged
Conversation
|
@CeceOs92 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! 🚀 |
❌ Deploy Preview for chainlearn failed.
|
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.
What
Implements four issues in one pass — a UI polish item, two reusable hooks, and an API-client improvement.
#282 — loading-skeleton improvements
tailwind.config.ts: newshimmerkeyframes +animate-shimmerutility (1.6s ease-in-out).components/ui/skeleton.tsx: baseSkeletongains ananimationprop ("shimmer"default |"pulse"|"none") rendering a moving-gradient sheen;motion-reducefalls back to a static fill; dark-mode tokens added; every block now carriesdata-slot="skeleton".components/shared/loading-skeleton.tsx: new content-shaped variantsCourseGridSkeleton,TableSkeleton(header + configurable rows/columns),FormSkeleton(label/input pairs + submit),ProfileSkeleton(avatar + detail grid). All skeleton roots exposerole="status"/aria-busywith an sr-only label. Existing variants preserved.app/courses/loading.tsxand newapp/settings/loading.tsxfor cross-page consistency.#292 — use-async.ts hook
src/lib/hooks/use-async.ts—useAsync(fn, options)returning{ execute, cancel, retry, reset, loading, error, data }. The async fn receives anAbortSignalfollowed by theexecuteargs. Eachexecutecancels the previous call, the hook aborts on unmount, and aborted results never reach state. Built-in error capture, exponential-backoffretries,immediate, andonSuccess/onErrorcallbacks.#293 — use-interval.ts hook
src/lib/hooks/use-interval.ts—useInterval(callback, delay, options).delay = nullpauses (and resumes on a number again), the latest callback is always invoked (ref, no stale closures), the interval clears on unmount and on delay change, plus animmediateoption and overlap-guarding for async callbacks.#298 — api/client.ts request deduplication
src/lib/api/client.ts— in-flight GETs are tracked by URL (+ JWT); concurrent callers for the same resource share one request/promise (and its retries) instead of each firing their own. Tracking is cleaned up on settle and on any mutation's cache invalidation. The shared request is owned by an internalAbortControllerthat is aborted only once every caller has detached, so one component unmounting rejects just its own promise (via awithAbortwrapper) without cancelling the request others are still awaiting.bypassCachereads are never shared.Tests
use-async.test.tsx,use-interval.test.tsx, request-deduplication cases inclient.test.ts, new-variant coverage inloading-skeleton.test.tsx.skeleton.test.tsx/loading-skeleton.test.tsxto assert the shimmer default and query bydata-slot="skeleton".tsc --noEmitintroduces no new errors; ESLint clean on changed files.Notes
vitestv4 on a cleannpm installand are unchanged by this PR — verified against a stashed baseline.Closes #282
Closes #292
Closes #293
Closes #298