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(providers): prevent unwanted re-initialization when parent component updates - @illuminist #725

Merged

Conversation

illuminist
Copy link
Contributor

@illuminist illuminist commented Jul 8, 2019

Description

I wrapped an extended firebase instance inside react useMemo hook in order to prevent extendedFirebaseInstance.initializeAuth() from being called for second time when parent component updated. And it should has improved performance since it wouldn't call createFirebaseInstance again to create a new and change firebase instance in the ReactReduxFirebaseContext which would cause update in every component that depends on firebase instance from said context.

Check List

If not relevant to pull request, check off as complete

  • All tests passing
  • Docs updated with any changes or examples if applicable
  • Added tests to ensure new feature(s) work properly

@prescottprue
Copy link
Owner

prescottprue commented Jul 9, 2019

Great work! 🎆 Haven't tested it myself, but I checked out the code. Really excited to see the hooks continuing to move forward

@prescottprue prescottprue changed the base branch from next to 3.0.0-alpha.13 July 13, 2019 03:57
@prescottprue prescottprue changed the title Fix unwanted re-initialization when parent component update fix(hooks): prevent unwanted re-initialization when parent component updates - @illuminist Jul 13, 2019
@codecov
Copy link

codecov bot commented Jul 13, 2019

Codecov Report

Merging #725 into 3.0.0-alpha.13 will decrease coverage by 2.76%.
The diff coverage is 100%.

@@                Coverage Diff                @@
##           3.0.0-alpha.13    #725      +/-   ##
=================================================
- Coverage           83.07%   80.3%   -2.77%     
=================================================
  Files                  30      30              
  Lines                 969    1102     +133     
  Branches              178     193      +15     
=================================================
+ Hits                  805     885      +80     
- Misses                164     217      +53

@prescottprue prescottprue changed the title fix(hooks): prevent unwanted re-initialization when parent component updates - @illuminist fix(providers): prevent unwanted re-initialization when parent component updates - @illuminist Jul 13, 2019
@prescottprue prescottprue merged commit 74dbda5 into prescottprue:3.0.0-alpha.13 Jul 13, 2019
@prescottprue prescottprue mentioned this pull request Jul 13, 2019
3 tasks
prescottprue added a commit that referenced this pull request Jul 13, 2019
* feat(types): add types for hooks including `useFirestore`, `useFirebase`, `useFirestoreConnect`, `useFirebaseConnect` - #653
* fix(types): make scopes optional in `credentials` - #671
* fix(docs): remove v2 auth ready docs from v3 docs - #676
* fix(providers): prevent unwanted re-initialization when parent component updates - #725 - @illuminist
* fix(profile): pass `updateProfile` options to action - #701 - @cruzdanilo 
* fix(firebaseConnect): remove `dispatch` from reserved props list - #675, #700
* feat(types): improve types for `withFirestore` and `withFirebase`
* feat(types): added `ExtendedFirebaseInstance` and `ExtendedFirestoreInstance` types
* feat(examples): update typescript example to use hooks
* fix(firestoreConnect): add error for passing of reserved props `firebase` and `firestore` when using `firestoreConnect`
* feat(types): add typing for firebase queries used in `firebaseConnect` and `useFirebaseConnect`
* fix(types): fix spelling of initialize in types
* feat(docs): add api docs pages for context providers and new hooks api 
* feat(docs): automatically find files for doc generation instead of having a constant that needs updating
* feat(core): add uglify and lodash plugins to webpack build to shrink bundle build size
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.

None yet

2 participants