Skip to content

TagSpaces is an offline, open source, document manager with tagging support

fix Newly opened folder should be scrolled to the top

sytolk5102c10545df
diff --git a/src/renderer/perspectives/grid/components/GridPagination.tsx b/src/renderer/perspectives/grid/components/GridPagination.tsx
index 2c242e276..2c74d30e0 100644
--- a/src/renderer/perspectives/grid/components/GridPagination.tsx
+++ b/src/renderer/perspectives/grid/components/GridPagination.tsx
@@ -16,7 +16,7 @@
*
*/
-import React, { useRef } from 'react';
+import React, { useEffect, useRef } from 'react';
import { useTheme } from '@mui/material/styles';
import Typography from '@mui/material/Typography';
import Tooltip from '-/components/Tooltip';
@@ -113,6 +113,12 @@ function GridPagination(props: Props) {
const containerEl = useRef<HTMLDivElement>(null);
+ useEffect(() => {
+ if (containerEl.current) {
+ containerEl.current.scrollTop = 0;
+ }
+ }, [currentDirectoryPath, containerEl.current]);
+
const handleChange = (event, value) => {
setCurrentPage(value);
if (containerEl && containerEl.current) {