Исправить автоскролл и TDZ в канале

This commit is contained in:
AidarKC
2026-08-19 20:38:03 +04:00
parent 5763eb828e
commit 4656a03ea9
+7 -3
View File
@@ -1255,6 +1255,8 @@ function mapApiMessageToPost(message, selector, localNumber) {
async function loadFromApi(route, channelId) {
const currentSessionLogin = String(state.session.login || '').trim();
const isAuthorized = !!currentSessionLogin;
let unreadCount = 0;
let messagesCount = 0;
let cachedFeed = null;
const ensureFeed = async () => {
if (cachedFeed) return cachedFeed;
@@ -1315,6 +1317,9 @@ async function loadFromApi(route, channelId) {
}
if (selector?.ownerBlockchainName && selector?.channelName) {
let unreadCount = 0;
let messagesCount = 0;
const routeOwnerRaw = String(selector.ownerBlockchainName || '').trim();
const routeOwnerNormalized = routeOwnerRaw.toLowerCase();
const routeOwnerLoginFromBch = extractLoginFromBlockchainName(routeOwnerRaw);
@@ -1382,8 +1387,7 @@ async function loadFromApi(route, channelId) {
const messages = Array.isArray(payload.messages) ? payload.messages : [];
let reverseChannelMissingWarning = '';
let mergedMessages = [...messages];
let unreadCount = 0;
let messagesCount = mergedMessages.length;
if (!messagesCount) messagesCount = mergedMessages.length;
const currentLogin = currentSessionLogin;
const ownerLogin = String(payload.channel?.ownerLogin || '').trim();
@@ -2014,7 +2018,7 @@ function renderBody(screen, navigate, routeKey, channelData, handlers) {
screen.append(feed, backButton);
}
applyPendingScroll(screen, routeKey, channelData.isOwnChannel || channelData.isDiary);
applyPendingScroll(screen, routeKey, channelData.isOwnChannel || channelData.isDiary || Number(channelData.unreadCount || 0) === 0);
return () => {
// noop
};