Skip to content

Commit

Permalink
farrah/80646/fixed buy/sell ad rate (#6867)
Browse files Browse the repository at this point in the history
* fixed observables

* fixed rate in advertiser page
  • Loading branch information
farrah-deriv committed Nov 9, 2022
1 parent 43c03f0 commit 7513201
Show file tree
Hide file tree
Showing 3 changed files with 8 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
3 changes: 3 additions & 0 deletions packages/p2p/src/stores/buy-sell-store.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,14 @@ export default class BuySellStore extends BaseStore {
is_sort_dropdown_open: observable,
is_submit_disabled: observable,
items: observable,
local_currencies: observable,
local_currency: observable,
payment_info: observable,
receive_amount: observable,
search_results: observable,
search_term: observable,
selected_ad_state: observable,
selected_local_currency: observable,
selected_payment_method_value: observable,
selected_payment_method_text: observable,
selected_value: observable,
Expand Down
7 changes: 5 additions & 2 deletions packages/p2p/src/stores/general-store.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ export default class GeneralStore extends BaseStore {
advertiser_sell_limit: observable,
block_unblock_user_error: observable,
balance: observable,
feature_level: observable,
inactive_notification_count: observable,
is_advertiser: observable,
is_advertiser_blocked: observable,
Expand Down Expand Up @@ -475,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 @@ -489,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

1 comment on commit 7513201

@vercel
Copy link

@vercel vercel bot commented on 7513201 Nov 9, 2022

Choose a reason for hiding this comment

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

Successfully deployed to the following URLs:

deriv-app – ./

deriv-app.vercel.app
deriv-app.binary.sx
deriv-app-git-master.binary.sx
binary.sx

Please sign in to comment.