Open source Loom alternative. Beautiful, shareable screen recordings.
Rust appcapcossloommacnextjsnextjs15open-sourceossreactrecordrustscreen-capturescreen-recorderscreenshotsolidjstauritauri-apptypescriptvite
fix(desktop): preserve scroll position during target list refresh
Richie McIlroy4d1ad0fda087
diff --git a/apps/desktop/src/routes/(window-chrome)/new-main/index.tsx b/apps/desktop/src/routes/(window-chrome)/new-main/index.tsxindex 24024d49a..97b26352a 100644--- a/apps/desktop/src/routes/(window-chrome)/new-main/index.tsx+++ b/apps/desktop/src/routes/(window-chrome)/new-main/index.tsx@@ -726,6 +726,50 @@ function TargetMenuPanel(props: TargetMenuPanelProps & SharedTargetMenuProps) {[],);+ let savedScrollTop = 0;+ let restoringScroll = false;++ createEffect(() => {+ search();+ savedScrollTop = 0;+ });++ const preservesScroll =+ props.variant === "recording" || props.variant === "screenshot";++ onMount(() => {+ if (!preservesScroll) return;++ const container = scrollContainerRef;+ if (!container) return;++ const onScroll = () => {+ if (!restoringScroll) {+ savedScrollTop = container.scrollTop;+ }+ };+ container.addEventListener("scroll", onScroll, { passive: true });++ const observer = new MutationObserver(() => {+ if (+ savedScrollTop > 0 &&+ Math.abs(container.scrollTop - savedScrollTop) > 1+ ) {+ restoringScroll = true;+ container.scrollTop = savedScrollTop;+ requestAnimationFrame(() => {+ restoringScroll = false;+ });+ }+ });+ observer.observe(container, { childList: true, subtree: true });++ onCleanup(() => {+ container.removeEventListener("scroll", onScroll);+ observer.disconnect();+ });+ });+return (<div class="flex flex-col w-full h-full min-h-0"><div class="flex gap-3 justify-between items-center mt-3">