Fix schema error after logout (#19933)

Detailed explanation:

The schema failure is due to utils.image-server/get-initials-avatar-uri being
called with a nil profile customization color right after the user confirms
logout.

Right after logging out, the subscription :profile/profile-with-image is
recomputed. One of its signal inputs is :profile/profile. Right after logout,
the output of sub :profile/profile is always nil (this is correct, nobody is
logged in). This means that the sub :profile/profile-with-image will try to
calculate the multiaccount URI by passing a nil profile. This is wasteful
computation and is also the cause of the schema for
utils.image-server/get-initials-avatar-uri to fail, because it expects the
profile's customization-color to be present.
This commit is contained in:
Icaro Motta 2024-05-09 08:52:27 -03:00 committed by GitHub
parent 3e5d758e92
commit ab191407ed
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 6 additions and 1 deletions

View File

@ -279,7 +279,12 @@
:<- [:initials-avatar-font-file]
:<- [:theme]
(fn [[profile ens-names port font-file theme] [_ avatar-opts]]
(replace-multiaccount-image-uri profile ens-names port font-file avatar-opts theme)))
;; Right after logout, this subscription is recomputed, but the sub
;; `:profile/profile` output will always be nil. We skip any further
;; processing because it's wasteful and because it will trigger a schema
;; error.
(when profile
(replace-multiaccount-image-uri profile ens-names port font-file avatar-opts theme))))
(re-frame/reg-sub
:profile/image