git ssb

2+

mixmix / ticktack



Commit 50a4cfa4f114b4bccad254905f4fc367dfa2bdc4

replace state effects (getting root messages) with feed.pull.rollup

mix irving committed on 11/28/2017, 1:26:17 AM
Parent: fb0788760b2ce15437b50ead1e804b650cc19077

Files changed

state/obs.jschanged
state/obs.jsView
@@ -13,9 +13,10 @@
1313 exports.needs = nest({
1414 'message.sync.unbox': 'first',
1515 'sbot.pull.log': 'first',
1616 'sbot.async.get': 'first',
17- 'feed.pull.channel': 'first'
17+ 'feed.pull.channel': 'first',
18+ 'feed.pull.rollup': 'first'
1819 })
1920
2021 exports.create = function (api) {
2122 var threadsObs
@@ -38,29 +39,16 @@
3839 }),
3940 pull.through(function (data) {
4041 lastTimestamp = data.timestamp
4142 }),
42- pull.map(unbox), pull.filter(Boolean)
43+ pull.map(unbox),
44+ pull.filter(Boolean),
45+ api.feed.pull.rollup()
4346 ),
4447 //value recovered from localStorage
4548 initial
4649 )
4750
48- var getting = {}
49- obs(function (state) {
50- var effect = state.effect
51- if(!effect) return
52-
53- state.effect = null
54- if(getting[effect.key]) return
55-
56- getting[effect.key] = true
57- api.sbot.async.get(effect.key, (err, msg) => {
58- if (!msg) return
59- obs.set(STATE=reduce(obs.value, unbox({key: effect.key, value: msg})))
60- })
61- })
62-
6351 //stream live messages. this *should* work.
6452 //there is no back pressure on new events
6553 //only a show more on the top (currently)
6654 pull(
@@ -103,9 +91,9 @@
10391
10492 },
10593
10694 'state.obs.threads': function buildThreadObs() {
107- if(threadsObs) return threadsObs
95+ if (threadsObs) return threadsObs
10896
10997 // DISABLE localStorage cache. mainly disabling this to make debugging the other stuff
11098 // easier. maybe re-enable this later? also, should this be for every channel too? not sure.
11199

Built with git-ssb-web