From e1a6dbeaed4ee17ed2f0d372635bfe59cb806848 Mon Sep 17 00:00:00 2001
From: gerlofvanek <gerlof@particl.io>
Date: Tue, 1 Apr 2025 22:52:31 +0200
Subject: [PATCH] Fix: Update orderbook rates.

- Update rates whenever new offer date is received via WebSocket.
- Ensure rates are updated when the offers table is refreshed.
- Keep profit/loss in sync.
---
 basicswap/static/js/offers.js | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/basicswap/static/js/offers.js b/basicswap/static/js/offers.js
index 355f3ec..3476c87 100644
--- a/basicswap/static/js/offers.js
+++ b/basicswap/static/js/offers.js
@@ -1062,6 +1062,7 @@ async function updateOffersTable() {
         requestAnimationFrame(() => {
             updateRowTimes();
             updatePaginationControls(Math.ceil(validOffers.length / itemsPerPage));
+            updateProfitLossDisplays();
             if (tableRateModule?.initializeTable) {
                 tableRateModule.initializeTable();
             }
@@ -2283,6 +2284,7 @@ document.addEventListener('DOMContentLoaded', async () => {
             requestAnimationFrame(() => {
                 updateOffersTable();
                 updatePaginationInfo();
+                updateProfitLossDisplays();
             });
         } catch (error) {
             console.error('[Debug] Error processing WebSocket message:', error);