What is the current behavior?
I have 2 components. Both are connected with firebaseConnect . Among these, one is a modal which is conditionally rendered and another one is a simple component which is always displayed.
The Modal Component hidden with a an action like this one:
export const hideAddSongModal = () => {
return dispatch => {
dispatch({
type: HIDE_ADD_MODAL
})
}
}
and rendered conditionally like this:
{this.props.userSettings.showAddModal && <Modal auth={isEmpty(this.props.auth) === false && this.props.auth} /> }
Here is the firebaseConnect structure for Home Component. Modal Compoenent has identical setup. They both have playlists in the redux state made available through firebaseconnect.
//Same structure for the Modal component.
export default compose(
firebaseConnect((props, firebase) => {
return props.auth.uid ? [{ path: `/playlists/${props.auth.uid}/`, merge: false }] : [`playlists`];
}),
connect(
(state, props) => ({
//playlists: state.firebase.data.playlists,
playlists: getVal(state.firebase, `data/playlists/${props.auth.uid}`),
userSettings: state.user,
auth: state.firebase.auth,
profile: state.firebase.profile // load profile
})
)
)(Home);
When The Modal is hidden through the HIDE_ADD_MODAL action, an UNSET_LISTENER action is also dispatched automatically. Which makes the Home components playlists props unresponsive. Meaning, the playlists is not directly connected to firebase and no change is being automatically updated for the other components that listen to the playlists. Because the the listener was unset and it was not automatically set again.
One Workaround is, instead of connecting the playlists directly with firebaseConnect to the Modal component, pass it as a props through parent component.
react-redux-firebase: 2.0.4
OS: Windows 7
Browser: Chrome (latest)
I think its similar to #368
Closing so that #368 is single place for tracking progress on this issue. @towfiqi thank you for reporting, it is great to know this is being experience by multiple people.
Most helpful comment
I think its similar to #368