mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-17 00:40:14 +01:00
fix: if db is empty, will never show new convos until refresh
This commit is contained in:
parent
a8344ec5bf
commit
626a8fbd8e
1 changed files with 1 additions and 1 deletions
|
|
@ -93,7 +93,7 @@ module.exports = {
|
||||||
// getConvos: async () => await Conversation.find({}).sort({ createdAt: -1 }).exec(),
|
// getConvos: async () => await Conversation.find({}).sort({ createdAt: -1 }).exec(),
|
||||||
getConvosByPage: async (pageNumber = 1, pageSize = 12) => {
|
getConvosByPage: async (pageNumber = 1, pageSize = 12) => {
|
||||||
try {
|
try {
|
||||||
const totalConvos = await Conversation.countDocuments();
|
const totalConvos = (await Conversation.countDocuments()) || 1;
|
||||||
const totalPages = Math.ceil(totalConvos / pageSize);
|
const totalPages = Math.ceil(totalConvos / pageSize);
|
||||||
const convos = await Conversation.find()
|
const convos = await Conversation.find()
|
||||||
.sort({ createdAt: -1, created: -1 })
|
.sort({ createdAt: -1, created: -1 })
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue