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

Can't refresh accounts #15

Open
umaknow-jessica opened this issue Oct 6, 2018 · 4 comments
Open

Can't refresh accounts #15

umaknow-jessica opened this issue Oct 6, 2018 · 4 comments

Comments

@umaknow-jessica
Copy link

I can't refresh a mint account. Here's how I use your function :

const client = await getClient(req);
await client.refreshAndWaitIfNeeded({maxAgeMillis: 1});
const accounts = await client.getAccounts();

I think the refresh doesn't start, because if I call client.getRefreshingAccounts() after the refresh, I get an empty array

@dhleong
Copy link
Owner

dhleong commented Oct 6, 2018

refreshAndWaitIfNeeded will wait until client.getRefreshingAccounts() returns an empty array. The client will periodically emit the refreshing event with a list of the accounts that are still being refreshed.

@umaknow-jessica
Copy link
Author

Thank you! But is my code supposed to refresh? I tried to refresh many times and I tried a lot of different things but my account will only refresh if I go on the mint website and hit refresh manually

@dhleong
Copy link
Owner

dhleong commented Oct 6, 2018

It's supposed to, but honestly it can be unreliable. It does seem to trigger a refresh (because running again a short time later will show that accounts have been updated and don't need refreshing) but I think I've observed the data not actually being fully ready after getRefreshingAccounts() returns empty. On the other hand, usually when I go to the Mint website after triggering a refresh through peppermint it will want to refresh again, so....

I'm not 100% sure what Mint is doing differently right now, and haven't had time to look back into it deeply. I'd be happy to get a PR from someone who's looked into this and can tighten it up a bit!

@umaknow-jessica
Copy link
Author

I understand, thank you for your quick response and for your time!

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

No branches or pull requests

2 participants