Skip to content
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

feat(query): config option to only attach one callback per listener path #77

Merged
merged 4 commits into from Apr 12, 2018

Conversation

compojoom
Copy link
Contributor

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

  • [ x] All tests passing
  • [ x] Docs updated with any changes or examples if applicable
  • Added tests to ensure new feature(s) work properly

Relevant Issues

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.
@codecov
Copy link

codecov bot commented Mar 29, 2018

Codecov Report

Merging #77 into master will decrease coverage by 2.37%.
The diff coverage is 56.66%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #77      +/-   ##
==========================================
- Coverage     100%   97.62%   -2.38%     
==========================================
  Files          17       17              
  Lines         976     1010      +34     
  Branches      169      174       +5     
==========================================
+ Hits          976      986      +10     
- Misses          0       24      +24
Impacted Files Coverage Δ
src/actions/firestore.js 84.51% <56.66%> (-15.49%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4048924...322e6e4. Read the comment docs.

@prescottprue prescottprue changed the title Count listeners feat(query): count listeners Mar 29, 2018
@prescottprue prescottprue changed the base branch from master to v0.4.0 April 12, 2018 19:19
@prescottprue prescottprue changed the title feat(query): count listeners feat(query): config option to only attach one callback per listener path Apr 12, 2018
@prescottprue prescottprue merged commit 79e3231 into prescottprue:v0.4.0 Apr 12, 2018
@prescottprue prescottprue mentioned this pull request Apr 19, 2018
3 tasks
prescottprue added a commit that referenced this pull request Apr 19, 2018
* fix(dataReducer): `DOCUMENT_ADDED` action type added to dataReducer - #84
* fix(query): `oneListenerPerPath` supports passing falsey values (before defining it at all would enable) - slight update to #77
* fix(query): prevent errors when combining string/object query config updated
* update(deps): [sinon](http://sinonjs.org/) and [sinon-chai](https://github.com/domenic/sinon-chai) dependencies updated (fixes child dep warning)
@prescottprue prescottprue mentioned this pull request May 6, 2018
3 tasks
prescottprue added a commit that referenced this pull request May 6, 2018
* fix(orderedReducer): remove `storeAs` from `updateItemInArray` - #91
* feat(actions): `runTransaction` action added - #76
* feat(core): Firebase's Firestore internals (from `firebase.firestore()`) exposed for use of methods such as `batch` - #76 
* feat(tests): unit tests added for `oneListenerPerPath` option - #77
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants