git ssb

2+

mixmix / ticktack



Commit 780b6c7547c81e9ac9c612627a555dbe8ccbf399

use throttle to slow down rendering new threads

Dominic Tarr committed on 12/8/2017, 5:03:35 AM
Parent: b763bdeb4867a9283ac98ff74113ac0dd62507f5

Files changed

app/html/comments.jschanged
app/html/comments.jsView
@@ -1,6 +1,6 @@
11 const nest = require('depnest')
2-const { h, Array: MutantArray, Value, map, computed, when, resolve } = require('mutant')
2+const { h, Array: MutantArray, Value, map, computed, when, resolve, throttle } = require('mutant')
33 const get = require('lodash/get')
44
55 exports.gives = nest('app.html.comments')
66
@@ -23,9 +23,10 @@
2323 function comments (root) {
2424 const { messages, channel, lastId: branch } = api.feed.obs.thread(root)
2525
2626 // TODO - move this up into Patchcore
27- const messagesTree = computed(messages, msgs => {
27+ var debouncer = null
28+ const messagesTree = computed(throttle(messages, 200), msgs => {
2829 return msgs
2930 .filter(msg => forkOf(msg) === undefined)
3031 .map(threadMsg => {
3132 const nestedReplies = msgs.filter(msg => forkOf(msg) === threadMsg.key)
@@ -137,4 +138,6 @@
137138
138139 function forkOf (msg) {
139140 return get(msg, 'value.content.fork')
140141 }
142+
143+

Built with git-ssb-web