From 3d1c0c61f8c851aa9924780f7fffea5f02eb9f19 Mon Sep 17 00:00:00 2001 From: Icaro Motta Date: Mon, 27 May 2024 18:54:49 -0300 Subject: [PATCH] Fix re-frame warning about fx being nil (#20175) Fixes a warning thrown by re-frame in the event :wallet/blockchain-status-changed. Here's a simplified example that generates the same warning. ```clojure (rf/reg-event-fx :user/fx-warning (fn [] {:fx nil})) ;; Prints warning re-frame: ":fx" effect expects a seq, but was given null (rf/dispatch [:user/fx-warning]) ``` --- src/status_im/constants.cljs | 2 ++ src/status_im/contexts/wallet/events.cljs | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/status_im/constants.cljs b/src/status_im/constants.cljs index 7d48515aed..810c9a01d0 100644 --- a/src/status_im/constants.cljs +++ b/src/status_im/constants.cljs @@ -194,6 +194,8 @@ (def ^:const community-id-length 68) +(def ^:const toast-chain-down-duration 5000) + ; BIP44 Wallet Root Key, the extended key from which any wallet can be derived (def ^:const path-wallet-root "m/44'/60'/0'/0") ; EIP1581 Root Key, the extended key from which any whisper key/encryption key can be derived diff --git a/src/status_im/contexts/wallet/events.cljs b/src/status_im/contexts/wallet/events.cljs index 691fd88934..c22b95c556 100644 --- a/src/status_im/contexts/wallet/events.cljs +++ b/src/status_im/contexts/wallet/events.cljs @@ -416,13 +416,13 @@ (log/info "[wallet] Test network enabled: " (boolean test-networks-enabled?)) (log/info "[wallet] Goerli network enabled: " (boolean is-goerli-enabled?))) {:db (assoc-in db [:wallet :statuses :blockchains] chains) - :fx (when chains-down? - [[:dispatch + :fx [(when chains-down? + [:dispatch [:toasts/upsert {:id :chains-down :type :negative :text (i18n/label :t/provider-is-down {:chains chain-names}) - :duration 10000}]]])}))) + :duration constants/toast-chain-down-duration}]])]}))) (defn reset-selected-networks [{:keys [db]}]