RocketChat / Rocket.Chat.PWA

Bandwidth efficient, simplified client built with Angular.
78 stars 38 forks source link

Data binding implementation #9

Closed Sing-Li closed 8 years ago

Sing-Li commented 8 years ago

@dandv Please see latest commit sync'd to the recent IO announced Polymer Toolkit and version. I am having some problem binding the <rk-events-core> custom element's received-messages property to an <iron-list> 's items attribute. For some reason, the JSON string always has extraneous Map in front of a hash, making the template substitution non-functional. The code as it exists will exhibit this problem. The screen capture shows a dump of what each item actually looked like. Any help appreciated. TIA

screen shot 2016-06-26 at 8 28 53 am

Sing-Li commented 8 years ago

Problem bypassed for now.

I am using immutable-js to eliminate unnecessary re-render when the set of rows displayed is the same. Turns out that even though the immutable rows JSON.stringifies to plain-jane looking JS structures - internally it is different in ways that would mess up <iron-list> 's template handling. The workable bypass for now is to cleanse by calling the immutable.Map's toIndexSeq().toJS() converter.