feat(query): config option to only attach one callback per listener path #77
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
don’t attach multiple listeners for the same path, but keep count
Basically the same one as here:
prescottprue/react-redux-firebase#392 but this time one can turn it on or off.
The implementation that we currently have config.allowMultipleListeners might work for some, but in our case it was attaching way to many listeners to the same data. Despite the fact that the listeners returned the same data, we were sill dispatching set_listener and response events on the store and this caused a noticable lag.
if we turn off config.allowMultipleListeners, then everything seems fine to the moment where we attach the same listener on a scene and unmount the scene - the original listener also gets unmounted…
With this change we keep a count and don’t trigger the unsetListener function unless there are no more listeners for this path.
Check List
If not relevant to pull request, check off as complete
Relevant Issues