wappsto-blanket
Advanced tools
Comparing version 2.3.5 to 2.3.6
@@ -213,3 +213,3 @@ "use strict"; | ||
if (response.ok) { | ||
if (!(!response.ok || !response.json)) { | ||
_context.next = 19; | ||
@@ -402,7 +402,5 @@ break; | ||
var _useState3 = (0, _react.useState)([[], pageSize]), | ||
var _useState3 = (0, _react.useState)([]), | ||
_useState4 = _slicedToArray(_useState3, 2), | ||
_useState4$ = _slicedToArray(_useState4[0], 2), | ||
items = _useState4$[0], | ||
pageLength = _useState4$[1], | ||
items = _useState4[0], | ||
setItems = _useState4[1]; | ||
@@ -415,3 +413,3 @@ | ||
var _useState7 = (0, _react.useState)('idle'), | ||
var _useState7 = (0, _react.useState)(_util.STATUS.IDLE), | ||
_useState8 = _slicedToArray(_useState7, 2), | ||
@@ -450,104 +448,108 @@ status = _useState8[0], | ||
}, [get]); | ||
(0, _react.useEffect)(function () { | ||
var startPagination = /*#__PURE__*/function () { | ||
var _ref9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() { | ||
var pageNumber, sessionObj, urlFull, _yield$getPages, newCount, pages, lastPage, newItems; | ||
var startPagination = (0, _react.useCallback)( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() { | ||
var pageNumber, sessionObj, urlFull, _yield$getPages, newCount, pages, lastPage, newItems, ids; | ||
return _regeneratorRuntime().wrap(function _callee3$(_context3) { | ||
while (1) { | ||
switch (_context3.prev = _context3.next) { | ||
case 0: | ||
if (url) { | ||
_context3.next = 2; | ||
break; | ||
} | ||
return _regeneratorRuntime().wrap(function _callee3$(_context3) { | ||
while (1) { | ||
switch (_context3.prev = _context3.next) { | ||
case 0: | ||
_context3.prev = 0; | ||
return _context3.abrupt("return"); | ||
if (url) { | ||
_context3.next = 3; | ||
break; | ||
} | ||
case 2: | ||
setStatus(_util.STATUS.PENDING); | ||
pageNumber = Number(pageNo) || 1; | ||
sessionObj = getSessionObj({ | ||
store: store, | ||
session: session | ||
}); | ||
urlFull = getUrl({ | ||
url: url, | ||
query: query, | ||
pageSize: pageSize | ||
}); | ||
_context3.next = 8; | ||
return getPages({ | ||
url: urlFull, | ||
store: store, | ||
useCache: useCache, | ||
page: pageNumber, | ||
requestsRef: requestsRef, | ||
pageSize: pageSize, | ||
sessionObj: sessionObj | ||
}); | ||
return _context3.abrupt("return"); | ||
case 8: | ||
_yield$getPages = _context3.sent; | ||
newCount = _yield$getPages.newCount; | ||
pages = _yield$getPages.pages; | ||
lastPage = Math.ceil(newCount / pageSize); | ||
case 3: | ||
setStatus(_util.STATUS.PENDING); | ||
pageNumber = Number(pageNo) || 1; | ||
sessionObj = getSessionObj({ | ||
store: store, | ||
session: session | ||
}); | ||
urlFull = getUrl({ | ||
url: url, | ||
query: query, | ||
pageSize: pageSize | ||
}); | ||
_context3.next = 9; | ||
return getPages({ | ||
url: urlFull, | ||
store: store, | ||
useCache: useCache, | ||
page: pageNumber, | ||
requestsRef: requestsRef, | ||
pageSize: pageSize, | ||
sessionObj: sessionObj | ||
}); | ||
if (!(pageNumber > lastPage && lastPage > 0)) { | ||
_context3.next = 15; | ||
break; | ||
} | ||
case 9: | ||
_yield$getPages = _context3.sent; | ||
newCount = _yield$getPages.newCount; | ||
pages = _yield$getPages.pages; | ||
lastPage = Math.ceil(newCount / pageSize); | ||
setCurrentPage(lastPage); | ||
return _context3.abrupt("return"); | ||
if (!(pageNumber > lastPage && lastPage > 0)) { | ||
_context3.next = 16; | ||
break; | ||
} | ||
case 15: | ||
_context3.next = 17; | ||
return getCurrentPageItems({ | ||
url: urlFull, | ||
store: store, | ||
useCache: useCache, | ||
page: pageNumber, | ||
requestsRef: requestsRef, | ||
pages: pages, | ||
currentItems: items, | ||
sessionObj: sessionObj | ||
}); | ||
setCurrentPage(lastPage); | ||
return _context3.abrupt("return"); | ||
case 17: | ||
newItems = _context3.sent; | ||
case 16: | ||
_context3.next = 18; | ||
return getCurrentPageItems({ | ||
url: urlFull, | ||
store: store, | ||
useCache: useCache, | ||
page: pageNumber, | ||
requestsRef: requestsRef, | ||
pages: pages, | ||
currentItems: items, | ||
sessionObj: sessionObj | ||
}); | ||
if (isMountedRef.current) { | ||
setPage(pageNumber); | ||
setCount(newCount); | ||
setItems([newItems, pageSize]); | ||
setItemIds(pages[pageNumber] || []); | ||
setStatus(_util.STATUS.SUCCESS); | ||
} | ||
case 18: | ||
newItems = _context3.sent; | ||
case 19: | ||
case "end": | ||
return _context3.stop(); | ||
if (isMountedRef.current) { | ||
ids = pages[pageNumber] || []; | ||
setPage(pageNumber); | ||
setCount(newCount); | ||
setItems(newItems); | ||
setItemIds(ids); | ||
setStatus(_util.STATUS.SUCCESS); | ||
} | ||
} | ||
}, _callee3); | ||
})); | ||
return function startPagination() { | ||
return _ref9.apply(this, arguments); | ||
}; | ||
}(); | ||
_context3.next = 25; | ||
break; | ||
startPagination()["catch"](function () { | ||
if (isMountedRef.current) { | ||
setItemIds(function (current) { | ||
return current.length && current[0].length ? [[], pageSize] : current; | ||
}); | ||
setItemIds(function (current) { | ||
return current.length ? [] : current; | ||
}); | ||
setStatus(_util.STATUS.ERROR); | ||
case 22: | ||
_context3.prev = 22; | ||
_context3.t0 = _context3["catch"](0); | ||
if (isMountedRef.current) { | ||
setItems(function (current) { | ||
return current.length ? [] : current; | ||
}); | ||
setItemIds(function (current) { | ||
return current.length ? [] : current; | ||
}); | ||
setCount(0); | ||
setStatus(_util.STATUS.ERROR); | ||
} | ||
case 25: | ||
case "end": | ||
return _context3.stop(); | ||
} | ||
} | ||
}); | ||
}, [pagination, isMountedRef, pageNo, pageSize, query, store, session, url, setCurrentPage, useCache]); | ||
}, _callee3, null, [[0, 22]]); | ||
})), [isMountedRef, pageNo, pageSize, query, store, session, url, setCurrentPage, useCache]); | ||
(0, _react.useEffect)(function () { | ||
startPagination(); | ||
}, [startPagination]); | ||
@@ -570,3 +572,3 @@ var refresh = function refresh() { | ||
get(); | ||
startPagination(); | ||
}; | ||
@@ -593,3 +595,3 @@ | ||
if (newItems.length > pageLength) { | ||
if (newItems.length > pageSize) { | ||
newItems.pop(); | ||
@@ -604,3 +606,3 @@ } | ||
})); | ||
setItems([newItems, pageLength]); | ||
setItems(newItems); | ||
} else { | ||
@@ -640,6 +642,6 @@ refresh(); | ||
}); | ||
get(); | ||
startPagination(); | ||
} else if (cache.url[idUrl].page[lastPage]) { | ||
cache.url[idUrl].page[lastPage].push(id); | ||
get(); | ||
startPagination(); | ||
} | ||
@@ -674,3 +676,3 @@ } | ||
newItems.splice(found, 1); | ||
setItems([newItems, pageLength]); | ||
setItems(newItems); | ||
var lastPage = Math.ceil(count / pageSize); | ||
@@ -744,3 +746,3 @@ | ||
} else { | ||
get(); | ||
startPagination(); | ||
} | ||
@@ -764,3 +766,3 @@ } | ||
if (found) { | ||
get(); | ||
startPagination(); | ||
} | ||
@@ -798,3 +800,3 @@ } | ||
page: page, | ||
pageSize: pageLength, | ||
pageSize: pageSize, | ||
setPage: setCurrentPage, | ||
@@ -801,0 +803,0 @@ refresh: refreshAll, |
{ | ||
"name": "wappsto-blanket", | ||
"version": "2.3.5", | ||
"version": "2.3.6", | ||
"description": "", | ||
@@ -36,26 +36,26 @@ "main": "dist/index.js", | ||
"deep-equal": "^2.0.5", | ||
"i18next": "^21.8.13", | ||
"i18next": "^21.8.16", | ||
"qs": "^6.11.0", | ||
"react": "^18.2.0", | ||
"react-dom": "^18.2.0", | ||
"react-i18next": "^11.18.0", | ||
"react-i18next": "^11.18.3", | ||
"react-redux": "^8.0.2", | ||
"wappsto-redux": "^4.2.2" | ||
"wappsto-redux": "^4.2.3" | ||
}, | ||
"devDependencies": { | ||
"@babel/cli": "^7.18.6", | ||
"@babel/core": "^7.18.6", | ||
"@babel/eslint-parser": "^7.18.2", | ||
"@babel/preset-env": "^7.18.6", | ||
"@babel/cli": "^7.18.10", | ||
"@babel/core": "^7.18.10", | ||
"@babel/eslint-parser": "^7.18.9", | ||
"@babel/preset-env": "^7.18.10", | ||
"@babel/preset-react": "^7.18.6", | ||
"@testing-library/react-hooks": "^8.0.1", | ||
"@typescript-eslint/parser": "^5.30.5", | ||
"babel-jest": "^28.1.2", | ||
"@typescript-eslint/parser": "^5.32.0", | ||
"babel-jest": "^28.1.3", | ||
"babel-polyfill": "^6.26.0", | ||
"eslint": "^8.19.0", | ||
"eslint": "^8.21.0", | ||
"eslint-config-airbnb": "^19.0.4", | ||
"eslint-config-prettier": "^8.4.0", | ||
"eslint-plugin-import": "^2.26.0", | ||
"eslint-plugin-jest": "^26.5.3", | ||
"eslint-plugin-jsx-a11y": "^6.6.0", | ||
"eslint-plugin-jest": "^26.7.0", | ||
"eslint-plugin-jsx-a11y": "^6.6.1", | ||
"eslint-plugin-prettier": "^4.2.1", | ||
@@ -65,4 +65,4 @@ "eslint-plugin-react": "^7.30.1", | ||
"husky": "^8.0.1", | ||
"jest": "^28.1.2", | ||
"jest-environment-jsdom": "^28.1.2", | ||
"jest": "^28.1.3", | ||
"jest-environment-jsdom": "^28.1.3", | ||
"jest-fetch-mock": "^3.0.3", | ||
@@ -69,0 +69,0 @@ "jest-websocket-mock": "^2.3.0", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
190198
+ Addedmath-intrinsics@1.1.0(transitive)
- Removedmath-intrinsics@1.0.0(transitive)
Updatedi18next@^21.8.16
Updatedreact-i18next@^11.18.3
Updatedwappsto-redux@^4.2.3