fix: Syntax error in loadLatest method
Fixed incorrect method placement that broke loadNewer. loadLatest now properly placed after loadNewer method.
This commit is contained in:
parent
1dd01ae2c1
commit
115af05a0b
@ -245,33 +245,6 @@ export class MessageLoaderV2 {
|
||||
* @returns {Promise<Array<Message>>}
|
||||
*/
|
||||
async loadNewer(chatId, limit = null) {
|
||||
|
||||
/**
|
||||
* Загружает последние сообщения (самые свежие в чате)
|
||||
* Используется для перехода к настоящему времени из исторического просмотра
|
||||
* @param {number} chatId - ID чата
|
||||
* @param {number} [limit] - Количество сообщений
|
||||
* @returns {Promise<LoadResult>}
|
||||
*/
|
||||
async loadLatest(chatId, limit = 50) {
|
||||
const requestKey = `latest_${chatId}`;
|
||||
|
||||
console.log('[MessageLoaderV2] Loading latest messages to present time');
|
||||
|
||||
try {
|
||||
const result = await this._loadLatest(chatId, limit, requestKey);
|
||||
|
||||
// Эмитим событие
|
||||
window.dispatchEvent(new CustomEvent('chat:messagesLoaded', {
|
||||
detail: { chatId, count: result.messages.length, type: 'latest' }
|
||||
}));
|
||||
|
||||
return result;
|
||||
} catch (error) {
|
||||
console.error('[MessageLoaderV2] Failed to load latest:', error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
const requestKey = `newer_${chatId}`;
|
||||
|
||||
const state = this._getLoadingState(chatId);
|
||||
@ -349,6 +322,33 @@ export class MessageLoaderV2 {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Загружает последние сообщения (самые свежие в чате)
|
||||
* Используется для перехода к настоящему времени из исторического просмотра
|
||||
* @param {number} chatId - ID чата
|
||||
* @param {number} [limit] - Количество сообщений
|
||||
* @returns {Promise<LoadResult>}
|
||||
*/
|
||||
async loadLatest(chatId, limit = 50) {
|
||||
const requestKey = `latest_${chatId}`;
|
||||
|
||||
console.log('[MessageLoaderV2] Loading latest messages to present time');
|
||||
|
||||
try {
|
||||
const result = await this._loadLatest(chatId, limit, requestKey);
|
||||
|
||||
// Эмитим событие
|
||||
window.dispatchEvent(new CustomEvent('chat:messagesLoaded', {
|
||||
detail: { chatId, count: result.messages.length, type: 'latest' }
|
||||
}));
|
||||
|
||||
return result;
|
||||
} catch (error) {
|
||||
console.error('[MessageLoaderV2] Failed to load latest:', error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Загружает сообщения вокруг указанной даты (timestamp)
|
||||
* Используется для навигации по датам через date picker
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user