-
-
Notifications
You must be signed in to change notification settings - Fork 555
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
Support React-Redux v6 #581
Comments
👍 thank you @markerikson , that help me |
@markerikson Thank you for reporting this! I am adding it to the proposed features in the v3.0.0 roadmap. That said, I wonder if this is a big enough change/rewrite to excuse trying out the move to the single repo for all of the redux-firebase tools 👀 (been wanting to do this for a long while for a number of reasons). |
@prescottprue can you add a timeline estimate to the roadmap ? |
I avoided that initially since it is hard to say accurately for a number of the features, especially this one since it is such a re-write. I will try to add timelines as soon as I can get a better understanding of scope though, so thanks for the suggestion. A good way to go for now is to assume that you should build for how things are currently. I try to keep a clear/visible update path for major breaking changes since there are a number of production applications that myself and others I work with will have to upgrade. If certain features need to be moved to other future versions or redux-firebase v1, then that will happen. |
Started looking into this, and I was able to get a change working with NOTE: This is just a prototype I threw together, and is not an available API. Just showing how I got things working // Initialize Firebase instance
firebase.initializeApp(fbConfig)
const App = () => (
<Provider store={store}>
<ReactReduxFirebaseProvider firebase={firebase} config={fbConfig} dispatch={store.dispatch}>
<Home />
</ReactReduxFirebaseProvider>
</Provider>
) Then it doesn't even require the store enhancer anymore! I also exposed The main downside being that it requires react 16 since it uses Its not available on npm yet, but I'm going to work on getting this into a |
Since React-Redux v6 requires a minimum of React 16.4, I don't think that's going to be an issue. In fact, I'd suggest you do the same. |
Just started the provider for firestore. When using just Firestore, the provider setup is like so: import firebase from 'firebase/app'
import 'firebase/auth'
import 'firebase/database'
import 'firebase/firestore' // make sure you add this for firestore
import { Provider } from 'react-redux'
import { ReactReduxFirebaseProvider } from 'react-redux-firebase';
import { createFirestoreInstance } from 'redux-firestore';
import { firebase as fbConfig, reduxFirebase as rrfConfig } from './config'
// Initialize Firebase instance
firebase.initializeApp(fbConfig)
const App = () => (
<Provider store={store}>
<ReduxFirestoreProvider
firebase={firebase}
config={rrfConfig}
dispatch={store.dispatch}
createFirestoreInstance={createFirestoreInstance}>
<Home />
</ReduxFirestoreProvider>
</Provider>
) Having both providers can be done through the main provider like so: <ReactReduxFirebaseProvider
firebase={firebase}
config={rrfConfig}
dispatch={store.dispatch}
createFirestoreInstance={createFirestoreInstance}>
<Home />
</ReactReduxFirebaseProvider> Equivalent to: <ReactReduxFirebaseProvider firebase={firebase} config={fbConfig} dispatch={store.dispatch}>
<ReduxFirestoreProvider
firebase={firebase}
config={fbConfig}
dispatch={store.dispatch}
createFirestoreInstance={createFirestoreInstance}>
<Home />
</ReduxFirestoreProvider>
</ReactReduxFirebaseProvider> That said, what are thoughts on the names (everyone feel free to answer)? I was going to do Still haven't released it to npm, but now that all of the HOCs use this new pattern on my branch I am planning on getting it published into an alpha version. Don't want to speak too soon, but hopefully to be released sometime this week. |
* feat(core): New react context API working with HOCs (`firebaseConnect`, `firestoreConnect` `withFirebase`, and `withFirestore`) - #581 * feat(core): support `react-redux` v6 by removing usage of `context.store` (used to be added by `Provider` from `react-redux`) * feat(core): Added `ReactReduxFirebaseContext` and `ReduxFirestoreContext` (with associated providers `ReactReduxFirebaseProvider` `ReduxFirestoreProvider` respectively) Breaking Change: react 16.4 is now a requirement due to using new context api
* feat(HOCs): switch `firestoreConnect` and `firebaseConnect` to use `componentDidMount` over `componentWillMount` - #564 * feat(core): New react context API working with HOCs (`firebaseConnect`, `firestoreConnect` `withFirebase`, and `withFirestore`) - #581 * feat(core): support `react-redux` v6 by removing usage of `context.store` (used to be added by `Provider` from `react-redux`) * feat(core): Added `ReactReduxFirebaseContext` and `ReduxFirestoreContext` (with associated providers `ReactReduxFirebaseProvider` `ReduxFirestoreProvider` respectively) * fix(core): shrink build sizes considerably by adding `babel-preset-minify` - #573 * feat(deps): update `hoist-non-react-statics` to `^3.1.0` * feat(deps): upgrade to `babel^7` * feat(deps): Update to `webpack^4` (along with `webpack-cli`) * feat(deps): update react peer dependency to `^16.4` for new Context API (matches `react-redux`)
Released It is all still young, so be sure to reach out if things don't work as expected or if you have any input on a more clear API. I want to get things ironed out in the pre-release versions as soon as possible. Thanks to to all for reporting! |
@salmazov Fixed. Thanks for reaching out. Feel free to open a new issue if anything is not working as you expect or if you find other typos in the docs. |
@prescottprue Okey! Thanks! |
It took me a little while to figure out how to use firestore profile instead of RTDB, you mentioned how to do it in the Readme for v3 but not the migration guide:
|
@sanbeaman Thanks for mentioning, I'll be sure to add it in there. |
I can't import ReactReduxFirebaseProvider from react-redux-firebase. There is no file such like this |
@PeterPil That would most likely be because you are using an incorrect version. Make sure to follow the v2 to v3 migration guide. If things still aren't working as expected, please feel free to open a new issue with code that replicates the unexpected behavior. |
Hi. |
By the way, iI followed: v2 to v3 migration guide. |
@QQ031004 it is available through the |
Thank you above: npm i --save react-redux-firebase@next |
Could someone please tells me what problem is below? TypeError: Object(...) is not a function
|
@QQ031004 It looks like you are still including the store enhancer ( |
Hey fellas,, having some trouble integrating with V3. I'm able to do all the above and connect to a firestore instance and fetch data using compose and firestoreConnect, but I don't have any of the methods for adding/updating/setting methods that i believe used to come with |
@AlexChaseJones |
I'm getting the following error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports. I want to use firestore and trying to configure the react-redux-firebase before configuring redux-firestore. I have followed the docs and below is my code. Can someone help with this? import React from "react";
import "./App.css";
//firebase
import firebase from "firebase/app";
//redux
import { Provider } from "react-redux";
import { createStore, combineReducers } from "redux";
import {
ReactReduxFirebaseProvider,
firebaseReducer
} from "react-redux-firebase";
const fbConfig = {
//my fbconfig object
};
const rrfConfig = { userProfile: "users" };
firebase.initializeApp(fbConfig);
const rootReducer = combineReducers({
firebase: firebaseReducer
});
const initialState = {};
const store = createStore(rootReducer, initialState);
const rrfProps = {
firebase,
config: rrfConfig,
dispatch: store.dispatch
};
function App() {
return (
<Provider store={store}>
<ReactReduxFirebaseProvider {...rrfProps}>
<h1>Hello</h1>
</ReactReduxFirebaseProvider>
</Provider>
);
}
export default App; |
@dmcshehan can you please open a new issue with a full codebase where the issue can be reproduced? It is hard to tell what may be wrong from just the one snippet. |
Do you want to request a feature or report a bug?
Bug / compatibility issue.
What is the current behavior?
FirestoreConnect
currently tries to access the Redux store out of legacy context:react-redux-firebase/src/firestoreConnect.js
Line 32 in 34b8f08
That's never been part of the React-Redux public API. React-Redux v6 now uses new context internally, so that breaks this library.
You'll need to rework the internals to access the Redux store a different way, likely using the
ReactReduxContext
instance exported from React-Redux.See supasate/connected-react-router#191 for an example of how
connected-react-router
is handling the change, and some related discussion at reduxjs/react-redux#1083 .What is the expected behavior?
Should render okay with no errors.
Which versions of dependencies, and which browser and OS are affected by this issue? Did this work in previous versions or setups?
Fails with React-Redux v6.0.0, works with v5.x and earlier.
The text was updated successfully, but these errors were encountered: