Repository navigation
Conversation
The splits dashboard had no data layer, and a withdraw or cancel left the displayed stream stale until the next read, which read as a failed write. Add useSplit/useSplits and create/distribute mutation hooks against a structural SplitsClientLike, plus an optimistic overlay shared with useStream so withdraw and cancel update immediately, reconcile on confirmation, and roll back independently on failure. Closes SorobanForge#201 Closes SorobanForge#202 🤖 Generated with Codebuff Co-Authored-By: Codebuff <noreply@codebuff.com>
|
@gbemi-aro is attempting to deploy a commit to the techalhaji's projects Team on Vercel. A member of the Team first needs to authorize it. |
This branch has not been deployed
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
Adds the splits data layer that the upcoming
/splitspage needs, and makes withdraw/cancel feel immediate instead of showing a stale balance until the next refetch.Closes #201
Closes #202
#201 — splits hooks
useSplit/useSplitsreturn the same{ data, error, loading, refetch }shape as the stream hooks.useCreateSplit/useDistributeSplitexposepending/success/errorstate through the shareduseContractMutationmachine and refetch splits when a transaction confirms.SplitsClientLike, so the hooks work now and accept a futureSplitsClientwithout changes. Listing degrades to an empty list whenlistSplitsis not available, mirroringuseStreams.#202 — optimistic withdraw/cancel
optimistic.tsoverlay: pending ops are kept separately from the last loaded stream and applied on read.withdrawn; cancel marks the streamcancelled.useStreamreaders refetch (bypassing the read cache) before the settled op is dropped, so the UI never flickers back to the pre-transaction value.Tests
packages/hooks/src/optimistic.test.ts— success, rollback, cancel, concurrent-mutation independence, withdraw without an amount.packages/hooks/src/splits.test.ts— load, error, listing + creator filter, unsupported client, create/distribute pending/success/error, null client.Verification
pnpm --filter @stellar-starter-kit/hooks test— 34/34 passpnpm --filter @stellar-starter-kit/hooks typecheckandlint— cleanpnpm typecheck(repo-wide turbo) — 18/18 tasks passmain(no conflicts)