@bento-core/paginated-table 1.0.1-ins.3 → 1.0.1-ins.31
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.
|
@@ -53,13 +53,7 @@ const getPaginatedQueryVariables = (queryVariables, table) => {
|
|
|
53
53
|
variables.sort_direction = sortOrder;
|
|
54
54
|
return variables;
|
|
55
55
|
};
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* @param {*} queryVariables
|
|
59
|
-
* @param {*} table (table state)
|
|
60
|
-
* @param {*} tab (tab)
|
|
61
|
-
* @returns table data
|
|
62
|
-
*/
|
|
56
|
+
let callCounter = 0;
|
|
63
57
|
const getTableData = _ref => {
|
|
64
58
|
let {
|
|
65
59
|
queryVariables,
|
|
@@ -84,11 +78,16 @@ const getTableData = _ref => {
|
|
|
84
78
|
const [tableData, setTableData] = (0, _react.useState)(null);
|
|
85
79
|
(0, _react.useEffect)(() => {
|
|
86
80
|
const controller = new AbortController();
|
|
81
|
+
callCounter += 1;
|
|
82
|
+
const currentCall = callCounter;
|
|
87
83
|
getData().then(result => {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
84
|
+
// Only update the table data if this is the most recent call
|
|
85
|
+
if (currentCall === callCounter) {
|
|
86
|
+
if (table.paginationAPIField && result[table.paginationAPIField]) {
|
|
87
|
+
setTableData(result[table.paginationAPIField]);
|
|
88
|
+
} else {
|
|
89
|
+
setTableData(result);
|
|
90
|
+
}
|
|
92
91
|
}
|
|
93
92
|
});
|
|
94
93
|
return () => {
|
|
@@ -11,7 +11,8 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
11
11
|
const TextFieldView = _ref => {
|
|
12
12
|
let {
|
|
13
13
|
clsName,
|
|
14
|
-
placeholder
|
|
14
|
+
placeholder,
|
|
15
|
+
ariaLabel
|
|
15
16
|
} = _ref;
|
|
16
17
|
const [text, setText] = (0, _react.useState)('');
|
|
17
18
|
const cartContext = (0, _react.useContext)(_cart.CartContext);
|
|
@@ -30,6 +31,7 @@ const TextFieldView = _ref => {
|
|
|
30
31
|
},
|
|
31
32
|
className: clsName,
|
|
32
33
|
placeholder: placeholder,
|
|
34
|
+
"aria-label": ariaLabel,
|
|
33
35
|
id: "multiline-user-coments"
|
|
34
36
|
});
|
|
35
37
|
};
|
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.31",
|
|
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",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"@bento-core/cart": "^1.0.0",
|
|
19
|
-
"@bento-core/table": "1.0.1-ins.
|
|
19
|
+
"@bento-core/table": "1.0.1-ins.28",
|
|
20
20
|
"@bento-core/tool-tip": "^1.0.0",
|
|
21
21
|
"@bento-core/util": "1.0.1-ins.0"
|
|
22
22
|
},
|
|
@@ -37,12 +37,7 @@ const getPaginatedQueryVariables = (queryVariables, table) => {
|
|
|
37
37
|
return variables;
|
|
38
38
|
};
|
|
39
39
|
|
|
40
|
-
|
|
41
|
-
* @param {*} queryVariables
|
|
42
|
-
* @param {*} table (table state)
|
|
43
|
-
* @param {*} tab (tab)
|
|
44
|
-
* @returns table data
|
|
45
|
-
*/
|
|
40
|
+
let callCounter = 0;
|
|
46
41
|
export const getTableData = ({ queryVariables, table }) => {
|
|
47
42
|
const client = useApolloClient();
|
|
48
43
|
const {
|
|
@@ -64,11 +59,16 @@ export const getTableData = ({ queryVariables, table }) => {
|
|
|
64
59
|
const [tableData, setTableData] = useState(null);
|
|
65
60
|
useEffect(() => {
|
|
66
61
|
const controller = new AbortController();
|
|
62
|
+
callCounter += 1;
|
|
63
|
+
const currentCall = callCounter;
|
|
67
64
|
getData().then((result) => {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
65
|
+
// Only update the table data if this is the most recent call
|
|
66
|
+
if (currentCall === callCounter) {
|
|
67
|
+
if (table.paginationAPIField && result[table.paginationAPIField]) {
|
|
68
|
+
setTableData(result[table.paginationAPIField]);
|
|
69
|
+
} else {
|
|
70
|
+
setTableData(result);
|
|
71
|
+
}
|
|
72
72
|
}
|
|
73
73
|
});
|
|
74
74
|
return () => {
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
const TextFieldView = ({
|
|
9
9
|
clsName,
|
|
10
10
|
placeholder,
|
|
11
|
+
ariaLabel,
|
|
11
12
|
}) => {
|
|
12
13
|
const [text, setText] = useState('');
|
|
13
14
|
const cartContext = useContext(CartContext);
|
|
@@ -25,6 +26,7 @@ const TextFieldView = ({
|
|
|
25
26
|
}}
|
|
26
27
|
className={clsName}
|
|
27
28
|
placeholder={placeholder}
|
|
29
|
+
aria-label={ariaLabel}
|
|
28
30
|
id="multiline-user-coments"
|
|
29
31
|
/>
|
|
30
32
|
);
|