feat(perps): persist Pro orders sort prefs - #9862
Merged
Merged
Conversation
Store ordersSortField and ordersSortDirection on proLayoutPreferences so the Orders panel sort survives market navigation and app restarts, matching the positions prefs pattern.
michalconsensys
temporarily deployed
to
default-branch
August 13, 2026 09:23 — with
GitHub Actions
Inactive
Store ordersSideFilter separately from positionsSideFilter so Positions and Orders can keep different long/short/all prefs.
abretonc7s
approved these changes
Aug 13, 2026
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Explanation
In Pro mode, mobile's Positions/Orders panel has independent sort configs, and the same should be true for side filter: a user can keep Long on Positions and Short on Orders. #9838 persisted the Positions sort and side filter on
proLayoutPreferences, but Orders sort/filter still lived in local React state and reset on remount (e.g. market navigation via stack push).This extends the existing network-independent flat
proLayoutPreferencesbag with:ordersSideFilter— default'all'ordersSortField— default'time'ordersSortDirection— default'desc'Field unions match mobile's Orders panel: side filter
'all' | 'long' | 'short', sort'orderValue' | 'size' | 'price' | 'time'. Values are stored as top-level scalars (same shape as the positions fields), so getter/setter/selector stay on shallow spread with no custom merge helper. Callers continue to usegetProLayoutPreferences()/setProLayoutPreferences(patch).ordersSideFilteris independent ofpositionsSideFilter.TypeScript breaking: consumers that construct a full
ProLayoutPreferencesobject must include the new required fields. Runtime persisted state is forward-compatible via merge-over-defaults.References
Checklist
Note
Low Risk
Preference schema extension with defaults merge; breaking only for code that manually constructs a full
ProLayoutPreferencesobject without the new fields.Overview
BREAKING: Extends flat
ProLayoutPreferenceswithordersSideFilter,ordersSortField, andordersSortDirection(defaults'all','time','desc') so Pro Orders panel filter/sort persist separately from Positions across markets and restarts, using the samegetProLayoutPreferences()/setProLayoutPreferences(patch)flow.Adds exported types
ProOrdersSideFilter,ProOrdersSortField, andProOrdersSortDirection; updatesDEFAULT_PRO_LAYOUT_PREFERENCES, package exports, changelog, and tests (including independence from positions prefs and merge-over-defaults for older persisted state).Reviewed by Cursor Bugbot for commit ceb550e. Bugbot is set up for automated code reviews on this repo. Configure here.