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: recreate instance immediately #350

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Conversation

KATT
Copy link
Contributor

@KATT KATT commented Aug 26, 2024

What

  • Recreates the Plaid instance immediately in a useMemo() rather than a useEffect()
  • Trashes the old Plaid instance when unmounting

Why

I have code that takes care of invalidating expired tokens and recreates the Plaid instance when/if needed & since the Plaid token isn't resolved immediately I can't trust the connect.open() to be immediately pointing to the new token rather than the old one

}
}, [plaid])

const ready = !!plaid && !loading && iframeLoaded;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was previously

const ready = plaid != null && (!loading || iframeLoaded);

But reading that code, it seems to me that iframeLoaded is completely unused - it can't be true without being first loading === true, so I'm guessing this fixes some edge-case bug

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.

1 participant