Skip to content

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

fix issue with not resetting pagination TSN490 (#1226)

Stanimir0ec9166b8b63
diff --git a/app/perspectives/grid-perspective/components/GridPagination.tsx b/app/perspectives/grid-perspective/components/GridPagination.tsx
index f6e254145..65a64d3e9 100644
--- a/app/perspectives/grid-perspective/components/GridPagination.tsx
+++ b/app/perspectives/grid-perspective/components/GridPagination.tsx
@@ -22,7 +22,11 @@ import Typography from '@material-ui/core/Typography';
import Pagination from '@material-ui/lab/Pagination';
import { FileSystemEntry } from '-/services/utils-io';
import i18n from '-/services/i18n';
-import { getCurrentDirectoryColor, isLoading } from '-/reducers/app';
+import {
+ getCurrentDirectoryColor,
+ getSearchResultCount,
+ isLoading
+} from '-/reducers/app';
import AppConfig from '-/config';
interface Props {
@@ -39,6 +43,8 @@ interface Props {
currentPage: number;
gridPageLimit: number;
currentLocationPath: string;
+ currentDirectoryPath: string;
+ searchResultCount: number;
}
const GridPagination = (props: Props) => {
@@ -59,7 +65,11 @@ const GridPagination = (props: Props) => {
useEffect(() => {
setPage(props.currentPage);
- }, [props.currentLocationPath]);
+ }, [
+ props.currentLocationPath,
+ props.currentDirectoryPath,
+ props.searchResultCount
+ ]);
const handleChange = (event, value) => {
// props.currentPage = value;
@@ -143,7 +153,8 @@ const GridPagination = (props: Props) => {
function mapStateToProps(state) {
return {
isAppLoading: isLoading(state),
- currentDirectoryColor: getCurrentDirectoryColor(state)
+ currentDirectoryColor: getCurrentDirectoryColor(state),
+ searchResultCount: getSearchResultCount(state)
};
}
diff --git a/app/perspectives/grid-perspective/components/MainContainer.tsx b/app/perspectives/grid-perspective/components/MainContainer.tsx
index a2e826568..a05b4187e 100644
--- a/app/perspectives/grid-perspective/components/MainContainer.tsx
+++ b/app/perspectives/grid-perspective/components/MainContainer.tsx
@@ -848,6 +848,7 @@ class GridPerspective extends React.Component<Props, State> {
renderCell={this.renderCell}
currentPage={1}
currentLocationPath={locationPath}
+ currentDirectoryPath={this.props.currentDirectoryPath}
/>
</GlobalHotKeys>
<AddRemoveTagsDialog
diff --git a/app/reducers/app.ts b/app/reducers/app.ts
index 991f382cd..f97fd1b72 100644
--- a/app/reducers/app.ts
+++ b/app/reducers/app.ts
@@ -1931,8 +1931,6 @@ export const isProgressOpened = (state: any) => state.app.progressDialogOpened;
export const getOpenedFiles = (state: any) => state.app.openedFiles;
export const getNotificationStatus = (state: any) =>
state.app.notificationStatus;
-export const getSearchResults = (state: any) =>
- state.app.currentDirectoryEntries;
export const getSearchResultCount = (state: any) =>
state.app.currentDirectoryEntries.length;
export const getCurrentLocationId = (state: any) => state.app.currentLocationId;