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 2 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
33 changes: 20 additions & 13 deletions 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,19 +116,22 @@
{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
:on-navigate-back #(rf/dispatch [:wallet/clear-last-collectible-details])
:page-nav-props {:type :title-description
:title collectible-name
:description collection-name
:right-side [{:icon-name :i/options
:on-press #(rf/dispatch
[:show-bottom-sheet
{:content collectible-actions-sheet
:theme theme}])}]
:picture preview-uri}}
{:navigate-back? true
:height 148
:page-nav-props {:type :title-description
:title collectible-name
:description collection-name
:right-side [{:icon-name :i/options
:on-press #(rf/dispatch
[:show-bottom-sheet
{:content collectible-actions-sheet
:theme theme}])}]
:picture preview-uri}}
[rn/view {:style style/container}
[rn/view {:style style/preview-container}
[rn/touchable-opacity
Expand Down Expand Up @@ -178,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))
3 changes: 2 additions & 1 deletion src/status_im/contexts/wallet/events/collectibles.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,8 @@
{:keys [collectibles]} response
collectible (first collectibles)]
(if collectible
{:fx [[:dispatch [:wallet/store-last-collectible-details collectible]]]}
{:fx [[:dispatch [:wallet/store-last-collectible-details collectible]]
[:dispatch [:navigate-to :wallet-collectible]]]}
(log/error "failed to get collectible details"
Copy link
Contributor

@ulisesmac ulisesmac Feb 13, 2024

Choose a reason for hiding this comment

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

Hey @mmilad75

thanks for applying the suggestion, but I think we could delay the navigation even more, inside the event that is storing:

image

wdyt?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure 👍 Let me apply it

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done @ulisesmac

{:event :wallet/get-collectible-details-done
:response response})))))
Expand Down
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])]))