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

Provide a sync-* method that preserves the ordering in firebase while giving access to the key. #73

Closed
dotboris opened this issue May 17, 2016 · 3 comments

Comments

@dotboris
Copy link

dotboris commented May 17, 2016

I'm currently making use of the sync-r method in matchbox.reagent to connect my reagent app with firebase with ease. I noticed that the elements in the r/atom returned by sync-r are not in the right order. I expect them to be in the same order as they are found in firebase.

In my app, I make use of conj! to get firebase to generate keys. What's great about this is that firebase offers some guaranties about the order of items when using .push() (or conj! in this case). I was hoping to be able to leverage those guaranties.

My guess is that I'm having this issue because sync-r returns a map which has no guaranties about order. Would it be possible to get an alternative to sync-r that returns a sorted-map instead of a regular map?

I should mention that I am aware of sync-list and from what I can tell it does respect ordering. My issue with it is that it doesn't give me access to the key of each element.

@crisptrutski
Copy link
Owner

Hey @dotboris - your desire is a totally reasonable one. Would accept a PR to switch to sorted-map, doubt there's significant overhead compared to going immutable.

@crisptrutski
Copy link
Owner

crisptrutski commented May 22, 2016

Ping @dotboris - is this still a bother? Thinking of just making sorted maps the default at the mapping layer when "immutalising" data snapshots. And this could be backed out of using a mechanism like discussed in #51.

Have a bit of time to spend on OSS this evening, so let me know if you would find this valuable.

@dotboris
Copy link
Author

@crisptrutski Yes this is still a bother and I would find this valuable.

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

No branches or pull requests

2 participants