Commit 930a234f8e8c982d1f957647399cb38c7eae3dba
improve search loading with feed.pull.channel
mix irving committed on 12/3/2017, 2:23:34 AMParent: 680732062c0d08b82953e62e36211cafffa71270
Files changed
app/page/blogSearch.js | changed |
app/page/blogSearch.js | ||
---|---|---|
@@ -9,8 +9,9 @@ | ||
9 | 9 | 'app.html.blogCard': 'first', |
10 | 10 | 'app.html.blogNav': 'first', |
11 | 11 | 'app.html.scroller': 'first', |
12 | 12 | 'channel.obs.recent': 'first', |
13 | + 'feed.pull.channel': 'first', | |
13 | 14 | 'feed.pull.public': 'first', |
14 | 15 | 'history.sync.push': 'first', |
15 | 16 | 'keys.sync.id': 'first', |
16 | 17 | 'message.html.channel': 'first', |
@@ -55,25 +56,24 @@ | ||
55 | 56 | })) |
56 | 57 | ) |
57 | 58 | ]) |
58 | 59 | |
60 | + var createStream = api.feed.pull.public | |
61 | + if (location.channel) createStream = api.feed.pull.channel(location.channel) | |
62 | + | |
59 | 63 | var blogs = api.app.html.scroller({ |
60 | 64 | classList: ['content'], |
61 | 65 | prepend: [ |
62 | 66 | api.app.html.blogNav(location), |
63 | 67 | searchField |
64 | 68 | ], |
65 | - stream: api.feed.pull.public, | |
69 | + stream: createStream, | |
66 | 70 | filter: () => pull( |
67 | 71 | pull.filter(msg => { |
68 | 72 | const type = msg.value.content.type |
69 | 73 | return type === 'post' || type === 'blog' |
70 | 74 | }), |
71 | - pull.filter(msg => !msg.value.content.root), // show only root messages | |
72 | - pull.filter(msg => { | |
73 | - if (!location.channel) return true | |
74 | - return msg.value.content.channel === location.channel | |
75 | - }) | |
75 | + pull.filter(msg => !msg.value.content.root) // show only root messages | |
76 | 76 | ), |
77 | 77 | // FUTURE : if we need better perf, we can add a persistent cache. At the moment this page is fast enough though. |
78 | 78 | // See implementation of app.html.context for example |
79 | 79 | // store: recentMsgCache, |
Built with git-ssb-web