From 9d1d6c6733c587a7170b5a4d396829e0f9ebc10c Mon Sep 17 00:00:00 2001 From: Sean Hagstrom Date: Mon, 16 Dec 2024 02:18:10 -0800 Subject: [PATCH] fix: use image clock when updating profile images to cause re-render (#21795) --- src/status_im/contexts/profile/edit/header/events.cljs | 6 ++++-- src/status_im/contexts/profile/settings/events.cljs | 6 ++++-- src/status_im/subs/profile.cljs | 8 +++++++- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/status_im/contexts/profile/edit/header/events.cljs b/src/status_im/contexts/profile/edit/header/events.cljs index 5e1f787ca31..1b2ca281205 100644 --- a/src/status_im/contexts/profile/edit/header/events.cljs +++ b/src/status_im/contexts/profile/edit/header/events.cljs @@ -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 diff --git a/src/status_im/contexts/profile/settings/events.cljs b/src/status_im/contexts/profile/settings/events.cljs index 0da979bd545..eea3fad8f58 100644 --- a/src/status_im/contexts/profile/settings/events.cljs +++ b/src/status_im/contexts/profile/settings/events.cljs @@ -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 [_] diff --git a/src/status_im/subs/profile.cljs b/src/status_im/subs/profile.cljs index abf449aecd0..f2aab8e9647 100644 --- a/src/status_im/subs/profile.cljs +++ b/src/status_im/subs/profile.cljs @@ -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 @@ -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 @@ -281,7 +283,10 @@ 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 @@ -289,6 +294,7 @@ {:port port :ratio pixel-ratio/ratio :image-name image-name + :clock image-clock :key-uid key-uid :theme theme} avatar-opts)}))