Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,10 @@ const PerpsMarketTabs: React.FC<PerpsMarketTabsProps> = ({
);

// Subscribe to data internally (marketStats moved to StatisticsTabContent to isolate price updates)
const { positions } = usePerpsLivePositions({ throttleMs: 0 });
const { positions } = usePerpsLivePositions({
throttleMs: 0,
useLivePnl: true,
});
Copy link

Choose a reason for hiding this comment

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

Bug: Unthrottled Live PnL impacts performance.

Enabling useLivePnl: true with throttleMs: 0 causes the component to re-render on every WebSocket price tick, potentially degrading performance. Other components using live PnL (like PerpsPositionsView) throttle updates to 1000ms. Consider adding throttling to balance real-time updates with performance, especially since the component already uses memoization to isolate price updates in StatisticsTabContent.

Fix in Cursor Fix in Web

const { orders: allOrders } = usePerpsLiveOrders({ throttleMs: 0 });

const position = useMemo(
Expand Down
Loading