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

Refactor <AccessType> component #145

Open
asimqt opened this issue May 26, 2020 · 0 comments
Open

Refactor <AccessType> component #145

asimqt opened this issue May 26, 2020 · 0 comments

Comments

@asimqt
Copy link
Contributor

asimqt commented May 26, 2020

There are some architectural issues with our current <AccessType> component which I'm noting here: These issues made working with the component hard:

  1. on componentDidMount we're calling initAccessType which makes the subsequent calls like this.getSubscription() and this.getPaymentOptions() always happening if somehow the component is re-mounted. This is not needed as we should let the users of the component decide when to call initAccessType as we're exposing it through renderProp anyway. The component calling itself counter the full renderProp idea.
    Note: when removing make sure the users of <AccessType> are calling initAccessType explicitly when needed.
  2. API calls like this.getPaymentOptions() should be cached in memory.
  3. There should be more exposed helper functions like setUser and getJWTToken and try to memoize the results.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant