Description
Do you want to request a feature or report a bug?
bug
(If this is a usage question, please do not post it here—post it on gitter. If this is not a “feature” or a “bug”, or the phrase “How do I...?” applies, then it's probably a usage question.)
What is the current behavior?
When transitioning between two components using react-router, the new component is mounted before the existing component is unmounted. Consequently, firebaseConnect()
creates a listener before the old one has been detached. This in most cases is fine, however in my specific case, both components are subscribing to the same firebase path (albeit with different query parameters) which doesn't work. The way that listeners are currently detached (see here), means that both the new and the old listeners are
detached.
This if statement does not catch this edge case as my query parameters are different.
I think this could be overcome by passing the listener to off(listener)
as documented here
If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem via codesandbox or similar.
- Mount a component using firebaseConnect.
- Mount a second component using firebaseConnect and referencing the same firebase path with different queries.
- Unmount the first component.
What is the expected behavior?
The second component continues to receive data from firebase after the first component has unmounted.
Which versions of dependencies, and which browser and OS are affected by this issue? Did this work in previous versions or setups?
"react": "^16.3.2",
"react-redux-firebase": "^2.1.1",
"react-router-dom": "^4.2.2",