fix #14236 Sometimes profile pictures don't load (#14257)

This commit is contained in:
frank 2022-11-07 23:58:29 +08:00 committed by GitHub
parent b378d88aaf
commit 187d147dc7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 7 deletions

View File

@ -197,8 +197,6 @@
:params [key-uid (clean-path path) ax ay bx by] :params [key-uid (clean-path path) ax ay bx by]
;; NOTE: In case of an error we can show a toast error ;; NOTE: In case of an error we can show a toast error
:on-success #(re-frame/dispatch [::update-local-picture %])}]} :on-success #(re-frame/dispatch [::update-local-picture %])}]}
(multiaccounts.update/optimistic :images [{:url path
:type (name photo-quality-large)}])
(bottom-sheet/hide-bottom-sheet)))) (bottom-sheet/hide-bottom-sheet))))
(fx/defn save-profile-picture-from-url (fx/defn save-profile-picture-from-url

View File

@ -228,10 +228,10 @@
:<- [:contacts/contacts] :<- [:contacts/contacts]
:<- [:profile/multiaccount] :<- [:profile/multiaccount]
:<- [:mediaserver/port] :<- [:mediaserver/port]
(fn [[contacts multiaccount port] [_ id]] (fn [[contacts {:keys [public-key] :as multiaccount} port] [_ id]]
(let [contact (or (get contacts id) (let [contact (or (when (= id public-key)
(when (= id (:public-key multiaccount)) multiaccount)
multiaccount))] (get contacts id))]
(if (nil? contact) (if (nil? contact)
(image-server/get-identicons-uri port id) (image-server/get-identicons-uri port id)
(multiaccounts/displayed-photo contact))))) (multiaccounts/displayed-photo contact)))))

View File

@ -20,7 +20,8 @@
:on-load (fn [e] :on-load (fn [e]
(when-let [on-load (:on-load props)] (when-let [on-load (:on-load props)]
(on-load e)) (on-load e))
(reset! loaded? true))}) (reset! loaded? true)
(reset! error? false))})
(when (or @error? (not @loaded?)) (when (or @error? (not @loaded?))
[placeholder (:style props) [placeholder (:style props)
(if @error? (if @error?