Commit 983320c77ce095de70365292b8db47b322af509a
lastId should return an array if there was a concurrent update to the thread (#18)
Dominic Tarr authored on 6/3/2017, 12:01:40 AMMikey committed on 6/3/2017, 12:01:40 AM
Parent: 654a3bef4ca321c95c33b7ec9447d1df0bcf3753
Files changed
feed/obs/thread.js | changed |
feed/obs/thread.js | ||
---|---|---|
@@ -46,10 +46,11 @@ | ||
46 | 46 … | |
47 | 47 … | var result = { |
48 | 48 … | messages, |
49 | 49 … | lastId: computed(messages, (messages) => { |
50 | - var last = messages[messages.length - 1] | |
51 | - if (last) return last.key | |
50 … | + var branches = sort.heads(messages) | |
51 … | + if(branches.length <= 1) branches = branches[0] | |
52 … | + return branches | |
52 | 53 … | }), |
53 | 54 … | rootId: computed(messages, (messages) => { |
54 | 55 … | if (branch && messages.length) { |
55 | 56 … | return messages[0].value.content.root |
Built with git-ssb-web