redux-firestore: bug(core): can't define property _: object is not extensible
What is the current behavior?
- creating the firestore store fails when using the latest
react-native-firebase
(6.0.1
)
What is the expected behavior?
- probably shouldn’t add behavior to the firebase object?
Which version of redux-firestore are you using? What about other dependencies?
"@react-native-firebase/app": "^6.0.1",
"@react-native-firebase/auth": "^6.0.1",
"@react-native-firebase/firestore": "^6.0.1",
"@react-native-firebase/messaging": "^6.0.1",
"@react-native-firebase/storage": "^6.0.1",
"react-redux-firebase": "next",
"redux-firestore": "0.9.0",
Which environments/browsers are affected by this issue? Did this work in previous versions or setups? react native
Minimal demo to reproduce issue (using codesandbox or similar) I will see if I can get to this…
The error I’m seeing is coming from createFirestoreInstance
and seems to be when it assigns the helpers:
firebase._ = merge(defaultInternals, firebase._); // eslint-disable-line no-param-reassign
It looks like rn-firebase has used Object.freeze
(https://github.com/invertase/react-native-firebase/blob/2fed4a9b38935b1973ce05d8e472a51daf3e4e89/packages/app/lib/internal/registry/namespace.js#L251) on the firebase object. Has anyone go this working with rn-firebase 6?
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 1
- Comments: 15 (11 by maintainers)
it works! you saved my day!
in my store config:
export const rrfProps = { firebase: firebase.app(), config: rrfConfig, dispatch: store.dispatch, createFirestoreInstance }
and then<ReactReduxFirebaseProvider {...rrfProps}><App/></ReactReduxFirebaseProvider>
@prescottprue That would be a little cleaner probably - I’m happy to try it the next time in there - probably when looking at fixing the tests for the PR… So, would
firebaseInstance
also befirebase.app()
then? I guess we’d need to look at where extend app puts stuff?@bcgilliom Amazing work here, thanks for looking into the
extendApp
route - we should be able to get this in the next major version for sure. Wondering if it is good to still have the full firebase instance passed then usefirebase.app().extendApp()
under the hood - open to thoughts on thatOhhh, yep! I don’t have it in front of me, but tou need to send
firebase: firebase.app()
(or similar) in the provider configThe firebase changes are in a branch too - just rebased on latest of master and squashed here https://github.com/bcgilliom/react-redux-firebase.git#fixes_for_rnfb6
I haven’t yet - just wanted to raise it just in case someone else had encountered this. It seems like cloning and then adding the helpers would work, but is that something that just needs to happen on init? I guess if the firebase object doesn’t change, that would be ok… I’m not too familiar with the internals of that. I will see what happens and report back!