-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
chore: fetch wallet images only when modal is open #3760
Conversation
🦋 Changeset detectedLatest commit: 0c5bfa5 The changes in this PR will be included in the next version bump. This PR includes changesets to release 19 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
9 Skipped Deployments
|
@@ -44,7 +46,7 @@ export class W3mModal extends LitElement { | |||
public constructor() { | |||
super() | |||
this.initializeTheming() | |||
ApiController.prefetch() | |||
ApiController.prefetchAnalyticsConfig() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need this here? @Cali93 can we remove ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, not sure if we need to prefetch the analytics config but if I recall correctly there's was an edge case where we wouldn't sent the first event when analytics isn't specified in the options but analytics is enabled through Cloud.
const promises = [ | ||
ApiController.fetchFeaturedWallets(), | ||
ApiController.fetchRecommendedWallets(), | ||
ApiController.fetchNetworkImages(), | ||
ApiController.fetchConnectorImages() | ||
] | ||
|
||
state.prefetchPromise = Promise.race([Promise.allSettled(promises)]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need Promise.race
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh seems like it was alwasy there, will remove it 🙏
@magiziz There is this issue happening that when you don't open the model, the network button doesn't render the network image. ![]() And when I open the networks list, this time it's fetching and updating ETH logo but the other networks are still empty. ![]() I'd propose going with an approach that fetching the network image when the item is visible on the screen. We can achieve this by using the I've implemented this on "All Wallets" screen that you can take as a ref. We also have tech doc about it, will share in the channel |
@@ -272,17 +272,21 @@ export const ApiController = { | |||
await ApiController.fetchRecommendedWallets() | |||
}, | |||
|
|||
prefetch() { | |||
prefetchWalletImages() { | |||
const promises = [ | |||
ApiController.fetchFeaturedWallets(), | |||
ApiController.fetchRecommendedWallets(), | |||
ApiController.fetchNetworkImages(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to be called on init as well else network btton doesn't properly render.
Maybe a cool optimizaton is loading this on the button render/init instead of here
Marking this PR as draft since it'd break the demo |
if (OptionsController.state.features?.analytics) { | ||
promises.push(ApiController.fetchAnalyticsConfig()) | ||
await ApiController.fetchAnalyticsConfig() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need to await this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah we don't do await it
Description
We now fetch wallet images when modal is open instead of fetching them during page load.
Type of change
Associated Issues
For Linear issues: Closes APKT-xxx
For GH issues: closes #...
Showcase (Optional)
prefetch.mov
Checklist