Skip to content

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