question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Incorrect ordering while using `singleEvent` as `true`

See original GitHub issue

Since setting singleEvent as true returns the whole set of data in a single response as a value:Object containing all the values i.e {key1:val1, key2:val2,...} (existing behavior) rather than value:Array<Object> i.e [{key:key1, val:val1}, {key:key2, val:val2},...] (expected behavior), the order becomes inconsistent while iterating through the result object.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
EddyVerbruggencommented, Feb 19, 2019

@JillevdW Looks like this is fixed in plugin version 8.0.0 (out soon). The order in the JSON object is now as specified as in the orderBy clause (on Android this was already the case), and I’ve added a new children property to the result object which is an array. Docs updated.

0reactions
JillevdWcommented, Jan 18, 2019

@EddyVerbruggen that could be true, I’m not sure, however that would imply the query function is not the same as the function I just posted, some observations:

  • In the Swift function, the snapshot function contains all the results from the query in an array. As such, the callback is only called once (not entirely true, since I use the function .observe which observes value changes as well, but it will still return all the items in one call, even on subsequent calls).
  • singleEvent set to true returns all the results from the query bundled into an object.
  • singleEvent set to false calls the callback once for every single item returned from the query.

So if what you say is correct, there is still a difference between the native behaviour and the way the interface here exposes them, perhaps that is not really relevant to anyone that hasn’t used the native library, but it is relevant here since we lose the order of elements when using singleEvent = true.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Incorrect usage of UNION and ORDER BY? - Stack Overflow
Using parentheses fixed my problem while using Order by and limit clauses in the query. My requirement was to get the top and...
Read more >
How To Fix Common Errors in Event Tracking Data Collection
It's a true false flag. I like to look at this as basically the bounce rate setting. If this is set to false...
Read more >
Chapter 11 - Inventory Management Flashcards - Quizlet
True or false: The order quantity in a fixed-order quantity model is the same, regardless if demand is known or uncertain. True. Which...
Read more >
Event Ordering With Apache Kafka - DEV Community ‍ ‍
In a series of articles, we uncover our journey towards Event-Driven microservices. The Ordering Problem. Stepping out of the comfort zone of ...
Read more >
8.0.0 Milestone · GitHub
Incorrect ordering while using singleEvent as true Firebase: Realtime DB iOS. #405 by Jai-Krish was closed on Feb 19, 2019.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found