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(frontend): load Carousel when missing settings in user profile #3893

Conversation

AntonioVentilii
Copy link
Collaborator

Motivation

The carousel was not being loaded for old accounts, because userSettings was always undefined.

However, we should distinguish between not having loaded the user profile (from which userSettings derives), and having a missing field settings in the user profile (it happens for old accounts, since we introduced the field recently).

Changes

  • Improve userSettings derived store to set null when the user profile exists but it is missing the settings field.
  • Adapt tests.
  • Adapt DapsCarousel.

Tests

Provided.

Copy link
Member

@peterpeterparker peterpeterparker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thx

Note: I actually read the code for quite some minutes because I'm not entirely sure making a distinction undefined or null should be something that happens at the derive level. Another option I guess would have been having a dedicated $userSettingsLoaded: Readable<boolean> information but just idea so all good.

@AntonioVentilii AntonioVentilii enabled auto-merge (squash) December 7, 2024 10:37
@AntonioVentilii AntonioVentilii merged commit 752202e into main Dec 7, 2024
18 checks passed
@AntonioVentilii AntonioVentilii deleted the fix(frontend)/load-Carousel-when-missing-settings-in-user-profile branch December 7, 2024 10:39
@AntonioVentilii
Copy link
Collaborator Author

@peterpeterparker makes sense! Have a look at please, is that what you thought:

AntonioVentilii added a commit that referenced this pull request Dec 9, 2024
# Motivation

According to @peterpeterparker 's suggestion in
#3893 (review)
, we find a better way to distinguish if the user settings are not
available because the user profile is not loaded, or if they are missing
(old accounts for example).

The base difference is simply if the user profile is not `nullish`: if
it is not `nullish` and the settings are nullish, we are sure that the
`settings` are missing.

# Changes

- Create derived store `userProfileLoaded`.
- Use new store in `DappsCarousel`.

# Tests

Test created and adjusted.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants