Skip to content

Updates for React.StrictMode compliance #205

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

Merged
merged 6 commits into from
Nov 15, 2019

Conversation

shoeman22
Copy link
Contributor

@shoeman22 shoeman22 commented Nov 13, 2019

What:
When used within a <React.StrictMode /> block, this library was generating warnings since it was using the Legacy Context API. This PR updates CarouselProvider and WithStore to use the New Context API as recommended by react.

There was also another strict mode warning with regard to using setState firing on an unmounted component, so I moved the subscribe step in the Wrapper component in WithStore to componentDidMount() to correct this warning.

Why:
I want to try out Concurrent Mode and the React team recommends making sure your app works without warnings when in Strict Mode before giving it a go. This library was the last hiccup I needed to solve to be warning free.

How:
I forked the repo and made the changes.

Checklist:

  • Documentation added/updated (N/A)
  • Typescript definitions updated (N/A)
  • Tests added and passing (N/A)
  • Ready to be merged

Loving the library so far. Great work!

mrbinky3000
mrbinky3000 previously approved these changes Nov 13, 2019
Copy link
Collaborator

@mrbinky3000 mrbinky3000 left a comment

Choose a reason for hiding this comment

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

Nice! Thanks a lot.

@mrbinky3000 mrbinky3000 dismissed their stale review November 13, 2019 14:18

Just noticed tests were failing.

@mrbinky3000
Copy link
Collaborator

Thanks very much for doing this. However two tests are failing.

@bcarroll22
Copy link
Contributor

Awesome, thanks @shoeman22!

@allcontributors, please add @shoeman22 for code.

@allcontributors
Copy link
Contributor

@bcarroll22

I've put up a pull request to add @shoeman22! 🎉

@shoeman22
Copy link
Contributor Author

@mrbinky3000 @bcarroll22 ok, I updated the CarouselProvider to accommodate test properly. Sorry for the noise in the commits -- I'd pushed to my own fork with dist in it so I could reference in package.json locally.

Thanks for the shoutout on the contributors as well!

Copy link
Contributor

@bcarroll22 bcarroll22 left a comment

Choose a reason for hiding this comment

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

I'll wait for @mrbinky3000 to give the final approval before merging, but looks good to me 👍

@mrbinky3000 mrbinky3000 merged commit b80d67e into express-labs:master Nov 15, 2019
@tim-steele
Copy link
Contributor

@allcontributors, please add @shoeman22 for code.

@allcontributors
Copy link
Contributor

@tim-steele

I've updated the pull request to add @shoeman22! 🎉

@bcarroll22
Copy link
Contributor

🎉 This PR is included in version 1.24.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants