fix(web): keep sealed bid data out of dashboard empty/error states (#… - #470
Open
Mubking-dev wants to merge 2 commits into
Open
Mubking-dev wants to merge 2 commits into
Mubking-dev wants to merge 2 commits into
Conversation
…ub-Rosa-Issue#425) useDashboardData returned one flat object where a round payload could sit next to an error, so a failed load kept (and on retry re-rendered) a bid the contract still treats as sealed. The hook now returns a discriminated union in which only the ready state carries round data, builds every outcome from scratch, and lets only the most recently started load publish. - sdk: add SDK_ERROR_CODES, SdkErrorCode and sdkErrorCode(), classifying by error class only; existing error classes are unchanged - web: DashboardErrorState takes only an SDK error code; the empty state is shown only when the endpoint reports no round - web: move the state switch into DashboardContent and cover the empty, error, mid-load failure and out-of-order cases without a wallet Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Closes #425
Summary
The dashboard empty and error states can no longer carry or render round
data. The error state now shows an SDK error code.
Changes
errors.ts): addsSDK_ERROR_CODES,SdkErrorCodeandsdkErrorCode(error). It classifies by error class only and never readsproperties off the thrown value. Existing classes are unchanged; the API
snapshot is updated for the 3 new exports.
useDashboardData: returns a discriminated union(
loading|empty|error+code|ready+data).loaded round data.
overwrite newer state.
{ endpoint, fetchImpl }for testing.DashboardEmptyState: shown only fornull/round: null.DashboardErrorState: props are now{ code, onRetry }. The code isre-validated at runtime and falls back to
UNKNOWN.DashboardContent.tsx(new): the state switch, extracted so testscover the real wiring.
Behaviour changes to note
roundkey is treated as malformed, so it shows theerror state rather than the empty state.
state, since that case is now an error.
Acceptance criteria → tests (
DashboardStates.test.tsx)Assertions run against the full serialized render tree, including props
and attributes.
Also covered: retry from error, success replacing error, and both
out-of-order races. Removing the sequencing guard makes the race tests fail.
Verification
web:buildpassesPre-existing failures (also on clean
main, not touched here)useLiveRound.test.tsx, sopnpm web:testexits non-zerotime:guardflagsuseDashboardData.test.tsOpen questions
UNKNOWN, since the SDKhas no network error class. Would you like a dedicated
NETWORK_ERRORcode in a follow-up?
BidderProgressCardrenders
bidUsdcfor anOpenround whenever the endpoint sends it.Happy to open a separate issue.