Skip to content

Commit

Permalink
fix(client): comment list return comment count to reduce api request …
Browse files Browse the repository at this point in the history
…times

release @waline/client 0.14.2 @waline/vercel 0.22.5
  • Loading branch information
lizheming committed Jan 13, 2021
1 parent 4e5f006 commit ac4fdb9
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/client/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@waline/client",
"description": "client for waline comment system",
"version": "0.14.1",
"version": "0.14.2",
"keywords": [
"valine",
"waline",
Expand Down
4 changes: 2 additions & 2 deletions packages/client/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ function App({boxConfig, listConfig, copyRight}) {
}, {page: 1, totalPages: 0, count: 0, loading: true, data: []});

useEffect(() => {
fetchCount(listConfig).then(count => dispatch({count}));
fetchList({...listConfig, page}).then(resp => dispatch({
totalPages: resp.totalPages,
loading: false,
data: data.concat(resp.data)
data: data.concat(resp.data),
count: resp.count,
})).catch(_ => dispatch({loading: false}));
}, []);

Expand Down
2 changes: 1 addition & 1 deletion packages/server/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@waline/vercel",
"description": "vercel server for waline comment system",
"version": "0.22.4",
"version": "0.22.5",
"author": "lizheming <i@imnerd.org>",
"scripts": {
"lint": "eslint src/",
Expand Down
1 change: 1 addition & 0 deletions packages/server/src/controller/comment.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ module.exports = class extends BaseRest {
page,
totalPages: Math.ceil(rootCount / pageSize),
pageSize,
count: comments.length,
data: await Promise.all(rootComments.map(async comment => {
const cmt = await formatCmt(comment, users, this.config());
cmt.children = await Promise.all(comments
Expand Down

0 comments on commit ac4fdb9

Please sign in to comment.