You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The order book panel's open/closed state was local component state, so it reset to closed on every mount — navigating between markets or reloading the order entry page forced users who trade with the book open to re-open it each time.
This persists the panel state through the perps controller's existing proLayoutPreferences, alongside the already-persisted orderBookPosition:
Adds a selectOrderBookExpanded selector reading proLayoutPreferences?.orderBookExpanded, falling back to DEFAULT_PRO_LAYOUT_PREFERENCES.
Seeds isOrderBookOpen in perps-order-entry-page.tsx from that selector.
Persists on toggle via perpsSetProLayoutPreferences. The write is fire-and-forget — a failed preference save shouldn't block the UI toggle — and logs on rejection.
The preference is flat rather than per-market, so the panel opens in the same state on every symbol.
Also included: the order book config modal's layout pills had their selected and unselected styles inverted, so the unselected option appeared filled. Swaps PILL_SELECTED_CLASS / PILL_UNSELECTED_CLASS so the selected pill is the filled
one (bg-muted border-transparent).
Note for reviewers: the diff in perps-order-entry-page.tsx includes some incidental Prettier re-indentation of the existing TP/SL validation block — no logic change there.
Changelog
CHANGELOG entry: Added persistence for the perps order book panel, so it stays open or closed between visits
Related issues
Fixes: TAT-3737
Manual testing steps
Enable perps and open the perps order entry page for any market (e.g. BTC).
Toggle the order book panel open.
Navigate away (e.g. to another market or back to the wallet home) and return to the order entry page — the order book should still be open.
Reload the extension entirely and reopen the page — still open.
Toggle the panel closed, navigate away and back — it should stay closed.
Switch to a different market and confirm the panel state carries over (the preference is global, not per-market).
Open the order book settings modal and confirm the currently selected layout pill is the filled one, and that changing the position still works and persists.
I've completed the PR template to the best of my ability
I’ve included tests if applicable
I’ve documented my code using JSDoc format if applicable
I’ve applied the right labels on the PR (see labeling guidelines). Not required for external contributors.
Pre-merge reviewer checklist
I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.
Note
Low Risk
UI layout preference persistence and a cosmetic pill-style fix; no auth, payments, or trading logic changes.
Overview Persists the order book panel so open/closed no longer resets on every visit. The order entry page seeds isOrderBookOpen from a new selectOrderBookExpanded selector (proLayoutPreferences.orderBookExpanded, default closed) and writes the value on toggle through perpsSetProLayoutPreferences (fire-and-forget with error logging). The preference is global across markets, matching existing layout prefs like orderBookPosition.
Fixes order book config modal pills by swapping PILL_SELECTED_CLASS / PILL_UNSELECTED_CLASS so the selected layout option shows as filled (bg-muted) instead of the unselected one.
Tests cover selector defaults, mounting with persisted expanded state, and persistence calls on toggle.
Reviewed by Cursor Bugbot for commit 05bc898. Bugbot is set up for automated code reviews on this repo. Configure here.
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
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.
Description
The order book panel's open/closed state was local component state, so it reset to closed on every mount — navigating between markets or reloading the order entry page forced users who trade with the book open to re-open it each time.
This persists the panel state through the perps controller's existing
proLayoutPreferences, alongside the already-persistedorderBookPosition:selectOrderBookExpandedselector readingproLayoutPreferences?.orderBookExpanded, falling back toDEFAULT_PRO_LAYOUT_PREFERENCES.isOrderBookOpeninperps-order-entry-page.tsxfrom that selector.perpsSetProLayoutPreferences. The write is fire-and-forget — a failed preference save shouldn't block the UI toggle — and logs on rejection.The preference is flat rather than per-market, so the panel opens in the same state on every symbol.
Also included: the order book config modal's layout pills had their selected and unselected styles inverted, so the unselected option appeared filled. Swaps
PILL_SELECTED_CLASS/PILL_UNSELECTED_CLASSso the selected pill is the filledone (
bg-muted border-transparent).Note for reviewers: the diff in
perps-order-entry-page.tsxincludes some incidental Prettier re-indentation of the existing TP/SL validation block — no logic change there.Changelog
CHANGELOG entry: Added persistence for the perps order book panel, so it stays open or closed between visits
Related issues
Fixes: TAT-3737
Manual testing steps
Screenshots/Recordings
Before
After
Loom video showing persistence across markets:
https://www.loom.com/share/ead2698863c34b7fa27d7937eb6cafe3
Pre-merge author checklist
Pre-merge reviewer checklist
Note
Low Risk
UI layout preference persistence and a cosmetic pill-style fix; no auth, payments, or trading logic changes.
Overview
Persists the order book panel so open/closed no longer resets on every visit. The order entry page seeds
isOrderBookOpenfrom a newselectOrderBookExpandedselector (proLayoutPreferences.orderBookExpanded, default closed) and writes the value on toggle throughperpsSetProLayoutPreferences(fire-and-forget with error logging). The preference is global across markets, matching existing layout prefs likeorderBookPosition.Fixes order book config modal pills by swapping
PILL_SELECTED_CLASS/PILL_UNSELECTED_CLASSso the selected layout option shows as filled (bg-muted) instead of the unselected one.Tests cover selector defaults, mounting with persisted expanded state, and persistence calls on toggle.
Reviewed by Cursor Bugbot for commit 05bc898. Bugbot is set up for automated code reviews on this repo. Configure here.