#Firebase mobile app

13 messages · Page 1 of 1 (latest)

tiny hull
#

Howdy John!

Are you able to share a scrim/codepen/repo for this? It's easier to troubleshoot when the whole breadth of the project can be seen.

As for speculation, can you send the single parameter for onValue as an object or array?

proven aspen
#

Just a thought, I haven’t done this project yet as it was added after I had moved through this section and I haven’t come back to it yet. Could the one parameter be an object that includes username and comment and maybe a unique ID?

errant timber
#

Is the onValue fn provided by Firebase ? The callback fn accepts a parameter snapshot. How does it get the snapshot ? What is the purpose of allCommentsNotReversed ? Is it like arranging it in the reverse order based on the time it was commented on by someone ? What are you doing in the for loop ?

We have soo many questions as well. That's because your thought process will be turned into your code. But we don't know your thought process. So, we need a good amount of context behind your issue so that we can debug and see where the issue lies.

And thats the reason its ALWAYS better to share link to the code or even better to your entire scrim or repo if you have put it up on GitHub or somewhere 😄

daring patrol
#

Hi John, I'm just embarking on the js for this project so would love to see this code in a scrim or repo as well. Maybe we can team up and work out a solution together?

quick thunder
slim folio
#

I took a quick glance at the codepen. I think the key issue here is that the message and the name should be considered one atomic piece of data, and since you are separating them at submit time, you are creating the synchronization issue. Given the way the onValue event works, there's no way for Firebase to provide the now-separated data in the synchronized fashion you would like.

One solution to this problem would be to keep the message & name together in the same container/collection (whatever Firebase calls data at this level). I don't believe there was any detail in the course on how to do this, but IIRC the instructor did mention that the data can be an object or an array, so it should be possible. You may have to do some digging in the Firebase reference on how to do this.

quick thunder
quick thunder
errant timber
quick thunder
quick thunder