Skip to content

fix: default closed stock markets to token price |OK-61733 - #13222

Merged
originalix merged 3 commits into
xfrom
codex/fix-ok-61733-closed-market-token-price
Sep 8, 2026
Merged

fix: default closed stock markets to token price |OK-61733#13222
originalix merged 3 commits into
xfrom
codex/fix-ok-61733-closed-market-token-price

Conversation

@zy2000-star

@zy2000-star zy2000-star commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

OK-61733


Summary

Default to Token Price when the stock market is closed (OK-61733).

Previously, opening or switching stock details always reset the price source to Share Price. The page now initializes it from marketStatus.isOpen:

  • Closed: Token Price.
  • Open or unknown: Share Price.
  • Manual selections are preserved, including selections made before the response arrives.
  • Switching stocks initializes the default for the new stock.

Scope and risks

Limited to price-source initialization in the desktop stock detail layout. No changes to market APIs, chart data processing, or trading logic. The main regression risk is asynchronous responses or polling overriding the user's selection.

Validation

  • All 9 tests passed, covering market status, asynchronous loading, manual selection, polling, and stock switching.
  • yarn agent:check --profile commit passed, including TypeScript checks.
  • Live UI verification has not been performed.

@sidmorizon

Copy link
Copy Markdown
Contributor

@codex review

@sidmorizon

Copy link
Copy Markdown
Contributor

@codex security review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 7, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-07T14:29:59.337225Z 08b5d77 Manual request
🔒 Security Review Completed 2026-09-07T14:27:32.000213Z 08b5d77 Manual request
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@sidmorizon

Copy link
Copy Markdown
Contributor

@chatgpt-codex-connector

Copy link
Copy Markdown

Security review completed. No security issues were found in this pull request.

Reviewed commit: 08b5d772ae

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Delightful!

Reviewed commit: 08b5d772ae

ℹ️ 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".

const { stockId, stockDetail } = useStockDetail();
const isOpen = stockDetail?.marketStatus?.isOpen;
const [{ source: priceMode }, setPriceSource] = useMarketPriceSourceAtom();
const initializedRef = useRef(false);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

P1: [Returning to a stacked stock page skips reinitialization]

When a desktop user opens stock A, navigates to stock B, and then pops back, A can keep B’s price source. Desktop detail screens remain mounted in the navigation stack, so A’s hook instance still has initializedRef.current === true, while B has written to the shared global price-source atom.

Because returning to A changes neither A’s stockId nor its isOpen value, these effects do not reinitialize it. A closed stock can therefore come back showing the stale Share Price header and chart instead of Token Price.

Please make route focus the ownership boundary: reset and apply the focused stock’s current default on each focus epoch, while preventing blurred route instances from writing the global atom. A regression test should mount two route instances sharing the atom and switch focus between them.

@originalix
originalix merged commit 568e93b into x Sep 8, 2026
24 checks passed
@originalix
originalix deleted the codex/fix-ok-61733-closed-market-token-price branch September 8, 2026 02:01
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