Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

Change to throttle sidebar UI on public page #1228

Merged
merged 1 commit into from
Dec 28, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 6 additions & 4 deletions lib/depject/page/html/render/public.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
const nest = require('depnest')
const { h, send, when, computed, map, onceTrue } = require('mutant')
const { h, send, when, computed, map, onceTrue, throttle } = require('mutant')

const slow = (input) => throttle(input, 1000)

exports.needs = nest({
sbot: {
Expand Down Expand Up @@ -158,7 +160,7 @@ exports.create = function (api) {
h('div', {
classList: 'ProfileList'
}, [
map(whoToFollow, (id) => {
map(slow(whoToFollow), (id) => {
return h('a.profile', {
href: id
}, [
Expand All @@ -179,7 +181,7 @@ exports.create = function (api) {
h('div', {
classList: 'ProfileList'
}, [
map(peers, peer => {
map(slow(peers), peer => {
const address = peer.address
const connected = peer.data.state === 'connected'
const id = peer.data.key
Expand Down Expand Up @@ -211,7 +213,7 @@ exports.create = function (api) {
h('div', {
classList: 'ProfileList'
}, [
map(peers, peer => {
map(slow(peers), peer => {
const id = peer.data.key
return h('a.profile', { href: id }, [
h('div.main', [
Expand Down