fix(ui): preserve scroll position on customer profile feed

This commit is contained in:
Yera All
2026-04-07 00:04:47 +05:00
parent 8b2975ca9a
commit da2cd31c32
+27 -1
View File
@@ -1,4 +1,4 @@
const state = {
const state = {
user: 'admin',
role: 'admin',
token: null,
@@ -1235,7 +1235,18 @@ function renderCustomerSpotlight() {
);
}
if (target && customer) {
const listEl = target.querySelector('.customer-history-list');
const scrollPos = listEl ? listEl.scrollTop : 0;
const h = target.offsetHeight;
if (h > 0) target.style.minHeight = h + 'px';
target.innerHTML = customerSpotlightMarkup(customer);
if (h > 0) target.style.minHeight = '';
const newListEl = target.querySelector('.customer-history-list');
if (newListEl && scrollPos > 0) {
newListEl.scrollTop = scrollPos;
}
}
renderCustomerProfilePage();
}
@@ -1277,7 +1288,22 @@ function renderCustomerProfilePage() {
: `Клиент ${customer.customer_id} • омниканальный профиль`;
}
const listEl = target.querySelector('.customer-history-list');
const scrollPos = listEl ? listEl.scrollTop : 0;
const pageScroll = window.scrollY || document.documentElement.scrollTop;
const h = target.offsetHeight;
if (h > 0) target.style.minHeight = h + 'px';
target.innerHTML = customerSpotlightMarkup(customer, { pageView: true });
if (h > 0) target.style.minHeight = '';
const newListEl = target.querySelector('.customer-history-list');
if (newListEl && scrollPos > 0) {
newListEl.scrollTop = scrollPos;
}
if (pageScroll > 0 && pageScroll > window.scrollY) {
window.scrollTo(window.scrollX, pageScroll);
}
}
function syncCustomerFormUi() {