Skip to content

Commit 9021d2b

Browse files
committed
some adjusts
1 parent 43e4295 commit 9021d2b

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

components/peerdom/sources/common/base.mjs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,17 @@ export default {
1919
_setLastId(lastId) {
2020
this.db.set("lastId", lastId);
2121
},
22+
sortItems(items) {
23+
return items;
24+
},
2225
async emitEvent(maxResults = false) {
2326
const lastId = this._getLastId();
2427
const fn = this.getFunction();
2528

26-
const response = await fn();
29+
const response = this.sortItems(await fn());
2730

2831
let responseArray = [];
29-
for (const item of response) {
32+
for (const item of response.reverse()) {
3033
if (item.id == lastId) break;
3134
responseArray.push(item);
3235
}

components/peerdom/sources/new-member/new-member.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export default {
1515
return this.peerdom.listPeers;
1616
},
1717
getSummary(item) {
18-
return `New Member: ${item.firstName} ${item.lastName}`;
18+
return `New Member: ${item.firstName} ${item.lastName || ""}`;
1919
},
2020
},
2121
sampleEmit,

components/peerdom/sources/new-role/new-role.mjs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ export default {
1717
getSummary(item) {
1818
return `New Role Created: ${item.name}`;
1919
},
20+
sortItems(items) {
21+
return items.sort((a, b) => new Date(a.createdAt) - new Date(b.createdAt));
22+
},
2023
},
2124
sampleEmit,
2225
};

0 commit comments

Comments
 (0)