git ssb

7+

dinoworm ๐Ÿ› / patchcore



Commit 4f3e54eaa5e60f7e8551798b984fbf3d4e0886c1

fix handling of realtime updates since #33

Matt McKegg committed on 9/29/2017, 9:27:57 AM
Parent: bb1e475fdd46fa47fff6cd11fbcb7fa4c1157d43

Files changed

contact/obs.jschanged
contact/obs.jsView
@@ -101,14 +101,17 @@
101101 function loadCache () {
102102 pull(
103103 api.sbot.pull.stream(sbot => sbot.friends.stream({live: true})),
104104 pull.drain(item => {
105- for (var source in item) {
106- if (ref.isFeed(source)) update(source, item[source])
107- }
108-
109105 if (!sync()) {
106+ // initial dump
107+ for (var source in item) {
108+ if (ref.isFeed(source)) update(source, item[source])
109+ }
110110 sync.set(true)
111+ } else {
112+ // handle realtime updates
113+ update(item.from, {[item.to]: item.value})
111114 }
112115 })
113116 )
114117 }

Built with git-ssb-web