Skip to content

Commit f6e38e7

Browse files
authored
fix React has detected a change in the order of Hooks (#22446)
1 parent 2dad919 commit f6e38e7

File tree

6 files changed

+71
-73
lines changed

6 files changed

+71
-73
lines changed

src/legacy/status_im/ui/screens/communities/members.cljs

Lines changed: 26 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -111,32 +111,31 @@
111111

112112
(defn view
113113
[]
114-
(let [{:keys [community-id]} (quo.context/use-screen-params)]
114+
(let [{:keys [community-id]} (quo.context/use-screen-params)
115+
my-public-key (rf/sub [:multiaccount/public-key])
116+
{:keys [permissions
117+
can-manage-users?
118+
admin]}
119+
(rf/sub [:communities/community community-id])
120+
sorted-members (rf/sub [:communities/sorted-community-members
121+
community-id])]
115122
(rn/use-mount
116123
#(rf/dispatch [:community/fetch-requests-to-join community-id]))
117-
(fn []
118-
(let [my-public-key (rf/sub [:multiaccount/public-key])
119-
{:keys [permissions
120-
can-manage-users?
121-
admin]}
122-
(rf/sub [:communities/community community-id])
123-
sorted-members (rf/sub [:communities/sorted-community-members
124-
community-id])]
125-
[:<>
126-
[topbar/topbar
127-
{:title (i18n/label :t/community-members-title)
128-
:subtitle (str (count sorted-members))}]
129-
[header community-id]
130-
(when (and can-manage-users? (= constants/community-on-request-access (:access permissions)))
131-
[requests-to-join community-id])
132-
[rn/flat-list
133-
{:data sorted-members
134-
:render-data {:community-id community-id
135-
:my-public-key my-public-key
136-
:can-kick-users? (and can-manage-users?
137-
(not= (:access permissions)
138-
constants/community-no-membership-access))
139-
:can-manage-users? can-manage-users?
140-
:admin? admin}
141-
:key-fn identity
142-
:render-fn render-member}]]))))
124+
[:<>
125+
[topbar/topbar
126+
{:title (i18n/label :t/community-members-title)
127+
:subtitle (str (count sorted-members))}]
128+
[header community-id]
129+
(when (and can-manage-users? (= constants/community-on-request-access (:access permissions)))
130+
[requests-to-join community-id])
131+
[rn/flat-list
132+
{:data sorted-members
133+
:render-data {:community-id community-id
134+
:my-public-key my-public-key
135+
:can-kick-users? (and can-manage-users?
136+
(not= (:access permissions)
137+
constants/community-no-membership-access))
138+
:can-manage-users? can-manage-users?
139+
:admin? admin}
140+
:key-fn identity
141+
:render-fn render-member}]]))

src/status_im/common/emoji_picker/view.cljs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,7 @@
170170

171171
(defn view
172172
[_]
173-
(let [{:keys [on-select]} (quo.context/use-screen-params)
174-
scroll-ref (atom nil)
173+
(let [scroll-ref (atom nil)
175174
set-scroll-ref #(reset! scroll-ref %)
176175
search-text (reagent/atom "")
177176
filtered-data (reagent/atom nil)
@@ -197,14 +196,15 @@
197196
:active-category active-category
198197
:should-update-active-category? (nil? @filtered-data)}))]
199198
(fn [sheet-opts]
200-
[sheet-view
201-
(assoc sheet-opts
202-
:search-active? (pos? (count @search-text))
203-
:on-change-text on-change-text
204-
:clear-states clear-states
205-
:filtered-data @filtered-data
206-
:set-scroll-ref set-scroll-ref
207-
:on-select on-select
208-
:on-viewable-items-changed on-viewable-items-changed
209-
:active-category active-category
210-
:scroll-ref scroll-ref)])))
199+
(let [{:keys [on-select]} (quo.context/use-screen-params)]
200+
[sheet-view
201+
(assoc sheet-opts
202+
:search-active? (pos? (count @search-text))
203+
:on-change-text on-change-text
204+
:clear-states clear-states
205+
:filtered-data @filtered-data
206+
:set-scroll-ref set-scroll-ref
207+
:on-select on-select
208+
:on-viewable-items-changed on-viewable-items-changed
209+
:active-category active-category
210+
:scroll-ref scroll-ref)]))))

src/status_im/common/lightbox/view.cljs

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -138,17 +138,11 @@
138138
:transparent? transparent?
139139
:bottom-text-component bottom-text-component}])]))
140140

141-
(defn- f-lightbox
142-
[]
143-
(let [{:keys [images index bottom-text-component on-options-press]}
144-
(quo.context/use-screen-params)
145-
props
146-
(utils/init-props)
147-
state
148-
(utils/init-state images index)
149-
handle-items-changed
150-
(fn [e]
151-
(on-viewable-items-changed e props state))]
141+
(defn- lightbox-internal
142+
[{:keys [images index bottom-text-component on-options-press]}]
143+
(let [props (utils/init-props)
144+
state (utils/init-state images index)
145+
handle-items-changed (fn [e] (on-viewable-items-changed e props state))]
152146
(fn []
153147
(let [animations (utils/init-animations (count images) index)
154148
derived (utils/init-derived-animations animations)]
@@ -170,4 +164,5 @@
170164

171165
(defn lightbox
172166
[]
173-
[:f> f-lightbox])
167+
(let [screen-params (quo.context/use-screen-params)]
168+
[lightbox-internal screen-params]))

src/status_im/contexts/profile/edit/modal/view.cljs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -187,10 +187,9 @@
187187
(and new-picture? acceptable-name?)
188188
(and new-name? valid-name?))))
189189

190-
(defn view
191-
[]
192-
(let [{:keys [pending-event]} (quo.context/use-screen-params)
193-
{initial-display-name :display-name
190+
(defn view-internal
191+
[{:keys [pending-event]}]
192+
(let [{initial-display-name :display-name
194193
initial-color :customization-color
195194
[initial-image] :images} (rf/sub [:profile/profile])
196195
top (safe-area/get-top)
@@ -265,3 +264,8 @@
265264
:scroll-y @scroll-y
266265
:on-submit update-profile
267266
:disabled? disabled?}]]]))))
267+
268+
(defn view
269+
[]
270+
(let [screen-params (quo.context/use-screen-params)]
271+
[view-internal screen-params]))

src/status_im/contexts/wallet/add_account/add_address_to_watch/confirm_address/view.cljs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@
1616

1717
(defn view
1818
[]
19-
(let [{:keys [address]} (quo.context/use-screen-params)
20-
placeholder (i18n/label :t/default-watched-address-placeholder)
19+
(let [placeholder (i18n/label :t/default-watched-address-placeholder)
2120
account-name (reagent/atom "")
2221
account-color (reagent/atom (rand-nth colors/account-colors))
2322
account-emoji (reagent/atom (emoji-picker.utils/random-emoji))
2423
name-error (reagent/atom nil)
2524
emoji-color-error (reagent/atom nil)]
2625
(fn []
27-
(let [accounts-names (rf/sub [:wallet/accounts-names])
26+
(let [{:keys [address]} (quo.context/use-screen-params)
27+
accounts-names (rf/sub [:wallet/accounts-names])
2828
accounts-emojis-and-colors (rf/sub [:wallet/accounts-emojis-and-colors])
2929
on-change-name (fn [new-name]
3030
(reset! account-name new-name)

src/status_im/contexts/wallet/add_account/create_account/new_keypair/confirm_backup/view.cljs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -116,25 +116,20 @@
116116
(on-try-again)))}
117117
:blur? shell?}]]))
118118

119-
(defn view
120-
[]
121-
(let [random-indices (random-selection)
122-
quiz-index (reagent/atom 0)
123-
incorrect-count (reagent/atom 0)
124-
show-error? (reagent/atom false)
125-
{:keys [on-success
126-
on-try-again
127-
masked-seed-phrase
128-
back-button?
129-
theme shell?]} (quo.context/use-screen-params)
130-
unmasked-seed-phrase (security/safe-unmask-data masked-seed-phrase)
131-
random-phrase (reagent/atom [])]
119+
(defn- view-internal
120+
[{:keys [on-success on-try-again masked-seed-phrase back-button? theme shell?]}]
121+
(let [random-indices (random-selection)
122+
quiz-index (reagent/atom 0)
123+
incorrect-count (reagent/atom 0)
124+
show-error? (reagent/atom false)
125+
random-phrase (reagent/atom [])]
132126
(fn []
133127
(rn/use-mount
134128
(fn []
135129
(native-module/get-random-mnemonic #(reset! random-phrase (string/split % #"\s")))))
136130
(when-not (empty? @random-phrase)
137-
(let [current-word-index (get random-indices
131+
(let [unmasked-seed-phrase (security/safe-unmask-data masked-seed-phrase)
132+
current-word-index (get random-indices
138133
(min @quiz-index (dec questions-count)))
139134
current-word (get unmasked-seed-phrase current-word-index)
140135
[options-row-0 options-row-1] (random-words-with-string @random-phrase current-word)
@@ -217,3 +212,8 @@
217212
{:on-press on-button-press
218213
:options options-row-1
219214
:shell? shell?}]]])))))
215+
216+
(defn view
217+
[]
218+
(let [screen-params (quo.context/use-screen-params)]
219+
[view-internal screen-params]))

0 commit comments

Comments
 (0)