Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The last collectible is shown for a moment while opening a new collectible #18750 #18793

Merged
merged 17 commits into from
Feb 20, 2024
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/status_im/contexts/wallet/collectible/view.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
:label (i18n/label :t/share-collectible)
:right-icon :i/external}]]]))

(defn view-internal
(defn f-view-internal
[{:keys [theme] :as _props}]
(let [selected-tab (reagent/atom :overview)
on-tab-change #(reset! selected-tab %)]
Expand All @@ -116,6 +116,10 @@
{collection-image :image-url
collection-name :name} collection-data
{collectible-name :name} collectible-data]
(rn/use-effect
(fn []
#(rf/dispatch [:wallet/clear-last-collectible-details]))
[])
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this empty vector can be omitted

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I want to run the code only in componentWillUnmount

[scroll-page/scroll-page
{:navigate-back? true
:height 148
Expand Down Expand Up @@ -177,4 +181,8 @@
:data tabs-data}]
[tabs/view {:selected-tab @selected-tab}]]]))))

(defn- view-internal
[props]
[:f> f-view-internal props])

(def view (quo.theme/with-theme view-internal))
8 changes: 7 additions & 1 deletion src/status_im/contexts/wallet/events/collectibles.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@

(defn store-last-collectible-details
[{:keys [db]} [collectible]]
{:db (assoc-in db [:wallet :last-collectible-details] collectible)})
{:db (assoc-in db [:wallet :last-collectible-details] collectible)
:dispatch [:navigate-to :wallet-collectible]})

(rf/reg-event-fx :wallet/store-last-collectible-details store-last-collectible-details)

Expand Down Expand Up @@ -126,3 +127,8 @@
(log/error "failed to get collectible details"
{:event :wallet/get-collectible-details-done
:response response})))))

(rf/reg-event-fx
:wallet/clear-last-collectible-details
(fn [{:keys [db]}]
{:db (update-in db [:wallet] dissoc :last-collectible-details)}))
3 changes: 1 addition & 2 deletions src/status_im/contexts/wallet/home/tabs/view.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,5 @@
:collectibles [collectibles/view
{:collectibles collectible-list
:on-collectible-press (fn [{:keys [id]}]
(rf/dispatch [:wallet/get-collectible-details id])
(rf/dispatch [:navigate-to :wallet-collectible]))}]
(rf/dispatch [:wallet/get-collectible-details id]))}]
[activity/view])]))