Skip to content

fix: stabilize swap and stock display states#12551

Merged
originalix merged 20 commits into
xfrom
chore/swap-quote-state-stability
Jul 20, 2026
Merged

fix: stabilize swap and stock display states#12551
originalix merged 20 commits into
xfrom
chore/swap-quote-state-stability

Conversation

@zhaono1

@zhaono1 zhaono1 commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

Summary

  • keep compatible Swap quote content visible during re-quotes while deriving action loading from current request identity and quote readiness
  • prevent disabled Preview and transient Refresh quotes states while the active quote round is still settling
  • stabilize Stock cold-start ownership, token and network icon continuity, chart and recent-pair display cache, and status transitions
  • reserve chart axis width and keep the live point stable during initial layout
  • align Stock skeleton, receive-value, and action-button dimensions across loading and settled states

Execution safety

  • cached or previous data is display-only and never marks the current request executable
  • Swap and Stock actions remain fail-closed until the current request, event, and required readiness gates settle
  • explicit terminal blockers such as insufficient balance, closed market, or no provider retain their own disabled labels

Scope

  • main UI, Swap Jotai-derived state, and SWR display cache only
  • no background transport, server API, database schema, or transaction execution changes

Validation

  • 9 focused Jest suites — 124 tests passed
  • yarn agent:check --profile commit — passed lint, format, context, staged lint, and staged TypeScript
  • Desktop Electron single-runtime validation covered Swap initial and same-input refresh transitions plus Stock cold start, token switching, chart, recent pairs, and 50px action-button height across ordinary/loading/input states

Behavior note

Display continuity and execution readiness are deliberately separate. Compatible previous or cached data may stay visible to avoid flicker, while the action button communicates whether the current request is executable.

@zhaono1 zhaono1 changed the title fix: stabilize swap quote refresh state fix: stabilize swap and stock display states Jul 20, 2026
@zhaono1
zhaono1 marked this pull request as ready for review July 20, 2026 04:21
@zhaono1
zhaono1 enabled auto-merge (squash) July 20, 2026 04:22

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f88c618fe9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/kit/src/views/Swap/pages/components/SwapStockDesktopContainer.tsx Outdated
Comment thread packages/kit/src/states/jotai/contexts/swap/actions.ts Outdated
Comment thread packages/kit/src/views/Swap/hooks/useSwapState.ts
Comment thread packages/kit/src/views/Swap/utils/swapStockTradeControl.ts
Comment thread packages/kit/src/views/Swap/utils/swapStockTradeControl.ts
Comment thread packages/kit/src/states/jotai/contexts/swap/actions.ts Outdated
@originalix
originalix disabled auto-merge July 20, 2026 08:33
@originalix
originalix merged commit 31aa74d into x Jul 20, 2026
16 checks passed
@originalix
originalix deleted the chore/swap-quote-state-stability branch July 20, 2026 08:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants