@bento-core/paginated-table 1.0.1-ins.18 → 1.0.1-ins.19
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.
- package/dist/table/TableService.js +10 -7
- package/package.json +1 -1
- package/src/table/TableService.js +10 -7
|
@@ -84,16 +84,19 @@ const getTableData = _ref => {
|
|
|
84
84
|
const [tableData, setTableData] = (0, _react.useState)(null);
|
|
85
85
|
(0, _react.useEffect)(() => {
|
|
86
86
|
const controller = new AbortController();
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
87
|
+
const timeoutId = setTimeout(() => {
|
|
88
|
+
getData().then(result => {
|
|
89
|
+
if (table.paginationAPIField && result[table.paginationAPIField]) {
|
|
90
|
+
setTableData(result[table.paginationAPIField]);
|
|
91
|
+
} else {
|
|
92
|
+
setTableData(result);
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
}, 5000);
|
|
94
96
|
return () => {
|
|
95
97
|
// cancel the request before component unmounts
|
|
96
98
|
controller.abort();
|
|
99
|
+
clearTimeout(timeoutId); // Clear the timeout if dependencies change or component unmounts
|
|
97
100
|
};
|
|
98
101
|
}, [queryVariables, page, rowsPerPage, sortOrder, sortBy]);
|
|
99
102
|
return {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bento-core/paginated-table",
|
|
3
|
-
"version": "1.0.1-ins.
|
|
3
|
+
"version": "1.0.1-ins.19",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "npm run lint && cross-env-shell rm -rf dist && NODE_ENV=production BABEL_ENV=es babel src --out-dir dist --copy-files",
|
|
@@ -64,16 +64,19 @@ export const getTableData = ({ queryVariables, table }) => {
|
|
|
64
64
|
const [tableData, setTableData] = useState(null);
|
|
65
65
|
useEffect(() => {
|
|
66
66
|
const controller = new AbortController();
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
67
|
+
const timeoutId = setTimeout(() => {
|
|
68
|
+
getData().then((result) => {
|
|
69
|
+
if (table.paginationAPIField && result[table.paginationAPIField]) {
|
|
70
|
+
setTableData(result[table.paginationAPIField]);
|
|
71
|
+
} else {
|
|
72
|
+
setTableData(result);
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
}, 5000);
|
|
74
76
|
return () => {
|
|
75
77
|
// cancel the request before component unmounts
|
|
76
78
|
controller.abort();
|
|
79
|
+
clearTimeout(timeoutId); // Clear the timeout if dependencies change or component unmounts
|
|
77
80
|
};
|
|
78
81
|
}, [queryVariables, page, rowsPerPage, sortOrder, sortBy]);
|
|
79
82
|
return { tableData };
|