Skip to content

Add structured log for trade panel price preview fetch failure - #662

Merged
Chucks1093 merged 4 commits into
accesslayerorg:devfrom
infimum90:Add-structured-log-for-trade-panel-price-preview-fetch-failure-with-creator-and-quantity-context
Jul 27, 2026
Merged

Add structured log for trade panel price preview fetch failure #662
Chucks1093 merged 4 commits into
accesslayerorg:devfrom
infimum90:Add-structured-log-for-trade-panel-price-preview-fetch-failure-with-creator-and-quantity-context

Conversation

@infimum90

Copy link
Copy Markdown
Contributor

Closes #655 — src/hooks/tests/optimisticBuy.test.ts
Created 2 unit tests verifying useTradeMutation's onMutate cache isolation:

does not mutate the cache of a different creator — confirms only the target creator's holdings are updated
rolls back only the affected creator's cache on error — confirms onError restores only previousHoldings for the correct creator, leaving unrelated creators untouched
Uses renderHook within QueryClientProvider, and queryClient.setQueryData for rollback isolation assertions.

Closes #651 — src/pages/tests/creatorInfiniteScroll.test.tsx
Created 2 integration tests for infinite scroll pagination (7 creators, PAGE_SIZE=6):

appends without duplicating — renders 6 on page 1, clicks "Load more", confirms all 7 appear with no duplicates and the button disappears
keeps page 1 visible — same flow but asserts the first 6 creators remain present after page 2 loads
Mocks CreatorCard, FeaturedCreatorAudienceChip, StellarConnectionQualityBadge, framer-motion, useNetworkMismatch, useStaleData, and courseService.getCourses. Sets localStorage to 'infinite' mode. Handles the 300ms filter-loading state via findByRole retries.

Closes #652 — src/components/common/TradeDialog.tsx
Added console.debug('[price-preview-failure]', {...}) when the dialog opens and the price preview can't be computed:

buy — keyPriceStroops is null (logs key_price_missing)
sell — estimatedProceedsStroops is null (logs estimate_unavailable)
Both logs include creator_name, quantity, side, and timestamp. Guarded by process.env.NODE_ENV !== 'test' and a useRef flag preventing re-logs within the same dialog session.

Closes #653 — src/pages/LandingPage.tsx
Added console.debug('[trade-confirmation-failure]', {...}) in handleConfirmTrade's catch block, including creator_name (FEATURED_CREATOR_NAME), side (buy/sell), quantity (amount), error (serialized message), and timestamp. Guarded by process.env.NODE_ENV !== 'test'.

@drips-wave

drips-wave Bot commented Jul 27, 2026

Copy link
Copy Markdown

@infimum90 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! 🚀

Learn more about application limits

@Chucks1093
Chucks1093 merged commit c4be603 into accesslayerorg:dev Jul 27, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment