Skip to content

feat(perps): persist Pro orders sort prefs - #9862

Merged
abretonc7s merged 3 commits into
mainfrom
feat/core-perps-orders-sort-prefs
Aug 13, 2026
Merged

feat(perps): persist Pro orders sort prefs#9862
abretonc7s merged 3 commits into
mainfrom
feat/core-perps-orders-sort-prefs

Conversation

@michalconsensys

@michalconsensys michalconsensys commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

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 proLayoutPreferences bag 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 use getProLayoutPreferences() / setProLayoutPreferences(patch).

ordersSideFilter is independent of positionsSideFilter.

TypeScript breaking: consumers that construct a full ProLayoutPreferences object must include the new required fields. Runtime persisted state is forward-compatible via merge-over-defaults.

References

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've communicated my changes to consumers by updating changelogs for packages I've changed
  • I've introduced breaking changes in this PR and have prepared draft pull requests for clients and consumer packages to resolve them

Note

Low Risk
Preference schema extension with defaults merge; breaking only for code that manually constructs a full ProLayoutPreferences object without the new fields.

Overview
BREAKING: Extends flat ProLayoutPreferences with ordersSideFilter, ordersSortField, and ordersSortDirection (defaults 'all', 'time', 'desc') so Pro Orders panel filter/sort persist separately from Positions across markets and restarts, using the same getProLayoutPreferences() / setProLayoutPreferences(patch) flow.

Adds exported types ProOrdersSideFilter, ProOrdersSortField, and ProOrdersSortDirection; updates DEFAULT_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.

Store ordersSortField and ordersSortDirection on proLayoutPreferences so the Orders panel sort survives market navigation and app restarts, matching the positions prefs pattern.
Store ordersSideFilter separately from positionsSideFilter so Positions and Orders can keep different long/short/all prefs.
@abretonc7s
abretonc7s added this pull request to the merge queue Aug 13, 2026
Merged via the queue into main with commit a7cac75 Aug 13, 2026
46 checks passed
@abretonc7s
abretonc7s deleted the feat/core-perps-orders-sort-prefs branch August 13, 2026 11:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants