only reset scrollposition when files have actually been loaded
Mwebclient/src/components/FileBrowser.tsx
@@ -182,8 +182,14 @@ export default function FileBrowser(props: FileBrowserProps) {
let filelistElement!: HTMLDivElement;
const scrollPositions: { part: string; pos: number }[] = [];
let lastDir = props.currentDir();
createEffect(
on(props.currentDir, () => {
//on props.files, because doing it on props.currentDir causes us to scroll up before the new content is being loaded
on(props.files, () => {
//don't update scroll pos if directory didn't change
//otherwise would cause jank when scrolling while in offline mode and synced items pop up
if (lastDir === props.currentDir()) return;
lastDir = props.currentDir();
//need the timeout, otherwise we could execute the scroll before rendering finishes
setTimeout(() => {
let parts = `${props.currentDir()}`.split("/");