PolymerElements / app-storage

Data-pipes and specialized services
61 stars 47 forks source link

Data binding breaks with 2 app-localstorage-document elements referencing the same key #75

Open karakonjul opened 8 years ago

karakonjul commented 8 years ago

Description

I have a JSON-serialized object in localStorage and two separate app-localstorage-document elements referencing it at the same time. Then I have a text input bound to a property of the stored object (2-way) using one app-localstorage-document, and then a read-only binding of the same property to a text label, but using the other app-localstorage-document. When the property is changed via the input the text label gets updated once, but then the binding breaks and it stops reflecting the changes in the input. The value seems to be correctly written to localStorage.

In my particular case I have the app-localstorage-document elements in different parts of the application, so I can't just use the same one.

Expected outcome

Both labels should contain the same value, which should reflect the contents of the input

Actual outcome

The first label is correctly kept synchronized with the input, but the second label is updated only on the first change and then the binding is broken. The second label uses a different app-localstorage-document.

Live Demo

https://output.jsbin.com/kehabulitu http://jsbin.com/meqijot

Steps to reproduce

Just type something in the input and observe the 2 labels above. Type in at least 2 characters!

Browsers Affected

all