fix: default closed stock markets to token price |OK-61733 - #13222
Conversation
|
@codex review |
|
@codex security review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Security review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
|
Codex Review: Didn't find any major issues. Delightful! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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); |
There was a problem hiding this comment.
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.
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: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
yarn agent:check --profile commitpassed, including TypeScript checks.