enhance: keep status check list scrolled on merge box reload (#38597)

Remember the scroll offset when the merge box reloads. This is a crude
patch now, a proper fix would be a fully vue-rendered template with a
json payload from backend, which is much more work. Idiomorph was also
considered but deemed unviable.
This commit is contained in:
silverwind
2026-07-24 06:10:26 +02:00
committed by GitHub
parent 99ca4bff7d
commit 9430e3230f

View File

@@ -53,7 +53,9 @@ function initRepoPullMergeBoxRefresh(el: Element) {
const resp = await GET(`${pullLink}/merge_box`);
if (!resp.ok) return;
const newEl = createElementFromHTML(await resp.text());
const scrollTop = el.querySelector<HTMLElement>('.commit-status-list')?.scrollTop;
el.replaceWith(newEl); // don't morph, do full replacement to make sure data-global-init and Vue components are re-initialized
if (scrollTop) newEl.querySelector<HTMLElement>('.commit-status-list')?.scrollTo({top: scrollTop, behavior: 'instant'});
},
});
}