Skip to content

Commit

Permalink
fixed rate in advertiser page
Browse files Browse the repository at this point in the history
  • Loading branch information
farrah-deriv committed Nov 8, 2022
1 parent ed8c5f5 commit 6485059
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 0 additions & 1 deletion packages/p2p/src/components/buy-sell/buy-sell.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ const BuySell = () => {
return () => {
disposeIsListedReaction();
disposeAdvertIntervalReaction();
buy_sell_store.setLocalCurrency(null);
};
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
Expand Down
6 changes: 4 additions & 2 deletions packages/p2p/src/stores/general-store.js
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,7 @@ export default class GeneralStore extends BaseStore {
};

this.disposeLocalCurrencyReaction = reaction(
() => this.root_store.buy_sell_store.local_currency,
() => [this.root_store.buy_sell_store.local_currency, this.active_index],
() => {
this.subscribeToLocalCurrency();
}
Expand All @@ -490,14 +490,16 @@ export default class GeneralStore extends BaseStore {

subscribeToLocalCurrency() {
const { floating_rate_store, buy_sell_store } = this.root_store;
const client_currency = this.client.local_currency_config?.currency;

this.ws_subscriptions?.exchange_rate_subscription?.unsubscribe?.();
this.ws_subscriptions.exchange_rate_subscription = subscribeWS(
{
exchange_rates: 1,
base_currency: this.client.currency,
subscribe: 1,
target_currency: buy_sell_store.local_currency ?? this.client.local_currency_config?.currency,
target_currency:
this.active_index > 0 ? client_currency : buy_sell_store.local_currency ?? client_currency,
},
[floating_rate_store.fetchExchangeRate]
);
Expand Down

0 comments on commit 6485059

Please sign in to comment.