updateCommunityBlock,
updatePersonBlock,
} from "@utils/app";
-import { restoreScrollPosition, saveScrollPosition } from "@utils/browser";
import {
getPageFromString,
getQueryParams,
setupTippy();
}
- componentWillUnmount() {
- saveScrollPosition(this.context);
- }
-
static async fetchInitialData({
client,
path,
});
}
- restoreScrollPosition(this.context);
setupTippy();
}
showLocal,
updatePersonBlock,
} from "@utils/app";
-import { restoreScrollPosition, saveScrollPosition } from "@utils/browser";
import {
getPageFromString,
getQueryParams,
setupTippy();
}
- componentWillUnmount() {
- saveScrollPosition(this.context);
- }
-
static async fetchInitialData({
client,
auth,
});
}
- restoreScrollPosition(this.context);
setupTippy();
}
export default function restoreScrollPosition(context: any) {
const path: string = context.router.route.location.pathname;
const y = Number(sessionStorage.getItem(`scrollPosition_${path}`));
+
window.scrollTo(0, y);
}
export default function saveScrollPosition(context: any) {
const path: string = context.router.route.location.pathname;
const y = window.scrollY;
+
sessionStorage.setItem(`scrollPosition_${path}`, y.toString());
}