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

add new mode and cleanups #47

Merged
merged 10 commits into from
Jan 4, 2017
Merged

add new mode and cleanups #47

merged 10 commits into from
Jan 4, 2017

Conversation

RahavLussato
Copy link
Collaborator

@RahavLussato RahavLussato commented Dec 28, 2016

hi @tiberiuc i did some changes :)

  1. remove dest parameter - its never set with value and its not exposed outside so its meaningless.
  2. fix once mode - after the prev changes it was broken.
  3. add check of getIn before deleteIn because if you have multiple listeners on the same path (unusual behavior) it will try to delete on path that was deleted before and then raise an error of invalidKeyType.
  4. add new delta mode - the new mode give us the ability to listen only for delta changes, the difference from "all" mode from today is that when you use "all" mode firebase will fire child_added for each child, its overkill because we can just take the first data as one snapshot and then after we have the snapshot of the current data we can start to listen to changes and manage them on the state. in this mode if you'll use dataToJS you'll get the whole management automatically, but if you want the snapshots, because you get one big snapshot on the start and then snapshot for each child it cannot be done automatically so i did some trick :), you'll have two entries on the state on snapshot, one is snapshot_initial and one is snapshot_deltas so you can manage the changes yourself if you want.
    i saw the approach of using mix of once and the "all" here: http://stackoverflow.com/questions/18270995/how-to-retrieve-only-new-data
  • to enable this mode use isListenOnlyOnDelta
  • this mode have also a flag called isAggregation this flag will turn bulk state update of childs, its good when you have big data with a lot of child changes. the aggregation is of every 1 sec.
  1. refactor to clean state on props changes and unmount, it will clean the state by default, if anyone want to not clean the state you can use isSkipClean flag.

the usage is like that:
@firebase((props) => ([{type:'all', isListenOnlyOnDelta:true, isAggregation:true, path:'bla/bla/bla'}]))

  • i'm sorry for the mess with the alignment changes its because i copy the code from my develop branch to master and it wasn't the same.

@RahavLussato
Copy link
Collaborator Author

@tiberiuc any plans to merge that ?

@tiberiuc tiberiuc merged commit c17aef9 into tiberiuc:master Jan 4, 2017
@tiberiuc
Copy link
Owner

tiberiuc commented Jan 4, 2017

sorry, it is merged

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.

2 participants