Commit ec85adadd27d70bb0aacbb5163e3925552cb8dd1
Syncs obs when pull-stream emits sync.
Piet Geursen committed on 5/14/2018, 8:07:58 AMParent: 20e2c40722bb439146e13f50e9c4c2e6811ab141
Files changed
poll/obs/get.js | changed |
poll/obs/get.js | ||
---|---|---|
@@ -90,10 +90,19 @@ | ||
90 | 90 | createBacklinkStream(key), |
91 | 91 | pull.drain(refs) |
92 | 92 | ) |
93 | 93 | |
94 | + //don't sync obs until we got sync from the stream to save some renders. | |
94 | 95 | pull( |
95 | 96 | refs.listen(), |
97 | + pull.filter(ref => ref.sync), | |
98 | + pull.drain(() => { | |
99 | + pollDoc.sync.set(true) | |
100 | + }) | |
101 | + ) | |
102 | + | |
103 | + pull( | |
104 | + refs.listen(), | |
96 | 105 | pull.filter(isPosition[CHOOSE_ONE]), // TODO: this shouldn't be hard coded |
97 | 106 | pull.map(position => { |
98 | 107 | return decoratePosition({position, poll}) |
99 | 108 | }), |
@@ -114,10 +123,8 @@ | ||
114 | 123 | pull.filter(isPosition[CHOOSE_ONE]), |
115 | 124 | pull.filter(position => position.value.author === myKey), |
116 | 125 | pull.drain(mine => myPositions.push(mine)) |
117 | 126 | ) |
118 | - | |
119 | - pollDoc.sync.set(true) | |
120 | 127 | }) |
121 | 128 | }) |
122 | 129 | return pollDoc |
123 | 130 | } |
Built with git-ssb-web