FirebaseExtended / polymerfire

Polymer Web Components for Firebase
https://www.webcomponents.org/element/firebase/polymerfire
MIT License
459 stars 142 forks source link

firebase-query duplicating values #244

Open kr05 opened 7 years ago

kr05 commented 7 years ago

Description

firbase-query is duplicating my database entries. My database has the following array:

patients: [ uid-1: object, uid-2: object ]

I am then binding the data property to a dom-repeat element, and the output is;

[uid-1, uid-2, uid-2, uid-1]

Expected outcome

dom-repeat displays [uid-1, uid-2]

Actual outcome

dom-repeat displays [uid-1, uid-2, uid-2, uid-1]

Live Demo

The relevant code is in this codeshare. The log statements for the firebase-query element is as follows:

image

Any help would be appreciated. I've been using polymerfire for a while now and this is the first time this happens.

Browsers Affected

tjmonsi commented 7 years ago

Do you have a working repo we can fork and play with so we can see the issue?

tbeattysk commented 7 years ago

I've been having similar issues, it's difficult to reproduce (it often happens when I reset, the page but not always). I'm guessing there is some race condition happening within the firebase-query element. Beyond me, I'll post a sample when I have the time.

jukbot commented 7 years ago

This issue seem to be same with #170 and #263 I also have this issue, BTW I think firebase-query call multiple times which add more than one "child_added"

tjmonsi commented 7 years ago

I have investigated it and have put it here: https://github.com/firebase/polymerfire/issues/263#issuecomment-328349397

Will try to issue a PR tomorrow for a quick fix and a long term fix that is performant. Will need to sleep on it though

merlinnot commented 7 years ago

I have the same issue in my app. Any progress on this?

tjmonsi commented 7 years ago

@merlinnot I'm just busy the last week. I will do it this Sunday. :)

jdromero commented 7 years ago

I have the same problem, is it solved?

merlinnot commented 7 years ago

@jdromero https://github.com/firebase/polymerfire/pull/270