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

fix: use image clock when updating profile images to cause re-render #21830

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 4 additions & 2 deletions src/status_im/contexts/profile/edit/header/events.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
[utils.re-frame :as rf]))

(rf/reg-event-fx :profile/update-local-picture
(fn [{:keys [db]} [images]]
(fn [{:keys [db now]} [images]]
{:db (if images
(assoc-in db [:profile/profile :images] images)
(assoc-in db
[:profile/profile :images]
(map #(assoc % :clock now) images))
(update db :profile/profile dissoc :images))}))

(rf/reg-event-fx :profile/edit-profile-picture-success
Expand Down
6 changes: 4 additions & 2 deletions src/status_im/contexts/profile/settings/events.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,10 @@
[:dispatch [:hide-bottom-sheet]]]})))

(rf/reg-event-fx :profile.settings/update-local-picture
(fn [{:keys [db]} [images]]
{:db (assoc-in db [:profile/profile :images] images)}))
(fn [{:keys [db now]} [images]]
{:db (assoc-in db
[:profile/profile :images]
(map #(assoc % :clock now) images))}))

(rf/reg-event-fx :profile.settings/mnemonic-was-shown
(fn [_]
Expand Down
8 changes: 7 additions & 1 deletion src/status_im/subs/profile.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
(fn [[profiles port font-file theme] [_ target-key-uid]]
(let [{:keys [images ens-name? customization-color] :as profile} (get profiles target-key-uid)
image-name (-> images first :type)
image-clock (-> images first :clock)
override-ring? (when ens-name? false)]
(when (and profile port)
{:config
Expand All @@ -75,6 +76,7 @@
:image-name image-name
:key-uid target-key-uid
:theme theme
:clock image-clock
:override-ring? override-ring?}}
{:type :initials
:options {:port port
Expand Down Expand Up @@ -281,14 +283,18 @@
customization-color]} profile
ens-name? (or ens-name? (seq ens-names))
avatar-opts (assoc avatar-opts :override-ring? (when ens-name? false))
images-with-uri (mapv (fn [{key-uid :keyUid image-name :type :as image}]
images-with-uri (mapv (fn [{key-uid :keyUid
image-name :type
image-clock :clock
:as image}]
(assoc image
:config
{:type :account
:options (merge
{:port port
:ratio pixel-ratio/ratio
:image-name image-name
:clock image-clock
:key-uid key-uid
:theme theme}
avatar-opts)}))
Expand Down