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]
;; NOTE: In case of an error we can show a toast error
:on-success #(re-frame/dispatch [::update-local-picture %])}]}
(multiaccounts.update/optimistic :images [{:url path
:type (name photo-quality-large)}])
(bottom-sheet/hide-bottom-sheet))))
(fx/defn save-profile-picture-from-url

View File

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

View File

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