firebase-element icon indicating copy to clipboard operation
firebase-element copied to clipboard

Selected item becomes deselected when updated in firebase

Open blasten opened this issue 9 years ago • 3 comments

From: https://github.com/PolymerElements/iron-list/issues/131

Steps to reproduce the issue:

  1. create an iron-list binded to a firebase collection element
  2. select an item
  3. update the item in firebase
  4. the selected item becomes unselected

Firebase collection uses : this.splice('data', this.data.indexOf(oldValue), 1, value); when it needs to update a value. Iron list as a result will delete and add the element to the list and in the process it will deselect.

I am not sure if this is an issue with the list or if the firebase component that maybe should use something more clever then splice. I am not an expert so i will live you this decision to you.

blasten avatar Jan 27 '16 23:01 blasten

I'm very new to polymer, so this may be unrelated, but I'm experiencing a similar issue using dom-repeat. I'm able to work around the behavior by adding a filter to the template that always returns true.

Repro:

<template is="dom-repeat" items="{{todos}}" as="todo">
  <paper-input label="Label" value="{{todo.label}}"></paper-input>
</template>

eac avatar Feb 06 '16 05:02 eac

I'm also new to polymer and having the same problem. Whenever a child is created with a dom-repeat, then it cannot seamlessly update itself via firebase. As every update fires, the data gets pushed back through from firebase and it triggers a recreation of the child. This has the effect of (for instance) blurring an input field on every key up event.

Filtering can fix it, but doesn't completely solve the issue. As in my case the dom-repeat list is dynamically populated and filtering it seems to break the functionality of the list.

Either it's a problem that anyone building complex apps with polymer/firebase faces, or we're structuring our apps incorrectly.

tinders avatar Feb 18 '16 16:02 tinders

@blasten @eac @tinders This should be fixed thanks to #111 !

MeTaNoV avatar Mar 23 '16 12:03 MeTaNoV