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 an issue with loading favorites on startup #1078

Merged
merged 1 commit into from
Jan 22, 2024

Conversation

micahmo
Copy link
Member

@micahmo micahmo commented Jan 22, 2024

Pull Request Description

This PR fixes an issue where initial usage of things like the community autocomplete and search page do not include favorites until the drawer is opened once.

Issue Being Fixed

Issue Number: N/A

Screenshots / Recordings

Before

favorite_before.mp4

After

favorites_after.mp4

Checklist

  • Did you update CHANGELOG.md?
  • Did you use localized strings where applicable?
  • Did you add semanticLabels where applicable for accessibility?

Comment on lines +46 to +48
await _getAccountInformation(GetAccountInformation(), emit);
await _getAccountSubscriptions(GetAccountSubscriptions(), emit);
await _getFavoritedCommunities(GetFavoritedCommunities(), emit);
Copy link
Member Author

Choose a reason for hiding this comment

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

The problem here is that adding these things as events causes them to execute asynchronously, which creates a race condition (specifically because calculating the favorites requires having all of the subscriptions first). By specifically invoking and awaiting, we ensure that everything executes in the right order.

Copy link
Member

@hjiangsu hjiangsu left a comment

Choose a reason for hiding this comment

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

LGTM, nice catch!

@hjiangsu hjiangsu merged commit 1dad7b6 into thunder-app:develop Jan 22, 2024
1 check passed
@micahmo micahmo deleted the fix/favorites-issue branch January 22, 2024 20:29
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