@fencyai/react 0.1.63 → 0.1.64

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,6 +2,7 @@ import { listFiles as listFilesApi } from '@fencyai/js';
2
2
  import { useState } from 'react';
3
3
  import { useFencyContext } from '../../provider/useFencyContext';
4
4
  export function useListFiles(props) {
5
+ const [currentPageParams, setCurrentPageParams] = useState(null);
5
6
  const [currentPage, setCurrentPage] = useState(null);
6
7
  const context = useFencyContext();
7
8
  const listFilesInternal = async (params) => {
@@ -104,6 +105,18 @@ export function useListFiles(props) {
104
105
  listFirstPage,
105
106
  listNextPage,
106
107
  listPreviousPage,
108
+ refetchCurrentPage: async () => {
109
+ if (currentPageParams == null) {
110
+ return {
111
+ type: 'error',
112
+ error: {
113
+ code: 'NO_CURRENT_PAGE',
114
+ message: 'No current page, please call listFirstPage first.',
115
+ },
116
+ };
117
+ }
118
+ return listFilesInternal(currentPageParams);
119
+ },
107
120
  currentPage,
108
121
  };
109
122
  }
@@ -5,5 +5,6 @@ export interface UseListFiles {
5
5
  listFirstPage: (params: ListFilesParams) => Promise<ListFilesResult>;
6
6
  listNextPage: (params: ListFilesParams) => Promise<ListFilesResult>;
7
7
  listPreviousPage: (params: ListFilesParams) => Promise<ListFilesResult>;
8
+ refetchCurrentPage: () => Promise<ListFilesResult>;
8
9
  currentPage: ListFilesPage | null;
9
10
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fencyai/react",
3
- "version": "0.1.63",
3
+ "version": "0.1.64",
4
4
  "description": "> TODO: description",
5
5
  "author": "staklau <steinaageklaussen@gmail.com>",
6
6
  "homepage": "",
@@ -34,7 +34,7 @@
34
34
  "prepublishOnly": "npm run build"
35
35
  },
36
36
  "devDependencies": {
37
- "@fencyai/js": "^0.1.63",
37
+ "@fencyai/js": "^0.1.64",
38
38
  "@types/jest": "^29.5.11",
39
39
  "@types/node": "^20.10.5",
40
40
  "@types/react": "^18.2.45",
@@ -43,7 +43,7 @@
43
43
  "typescript": "^5.3.3"
44
44
  },
45
45
  "peerDependencies": {
46
- "@fencyai/js": "^0.1.63",
46
+ "@fencyai/js": "^0.1.64",
47
47
  "react": ">=16.8.0",
48
48
  "zod": "^4.0.5"
49
49
  },
@@ -52,5 +52,5 @@
52
52
  "optional": false
53
53
  }
54
54
  },
55
- "gitHead": "fa1e08330dd81d0dafb1da3ad76417cf32b490a6"
55
+ "gitHead": "aa579549b3b9b701ccad73d7a8c310ec11787f4e"
56
56
  }