mirror of
https://github.com/go-gitea/gitea.git
synced 2026-07-24 23:35:19 +02:00
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:
@@ -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'});
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user