@bigbinary/neeto-commons-frontend 4.3.3 → 4.3.4
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/cjs/react-utils/useFetchNeetoApps/useFetchNeetoApps.js +5 -2
- package/cjs/react-utils/useFetchNeetoApps/useFetchNeetoApps.js.map +1 -1
- package/package.json +1 -1
- package/react-utils/useFetchNeetoApps/useFetchNeetoApps.js +5 -2
- package/react-utils/useFetchNeetoApps/useFetchNeetoApps.js.map +1 -1
|
@@ -16,10 +16,13 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
16
16
|
var useFetchNeetoApps = function useFetchNeetoApps(options) {
|
|
17
17
|
var _globalProps$user;
|
|
18
18
|
var scopedQueryKey = ["".concat(_query.QUERY_KEYS.NEETO_APPS_LIST, "-").concat((_globalProps$user = globalProps.user) === null || _globalProps$user === void 0 ? void 0 : _globalProps$user.id)];
|
|
19
|
-
var
|
|
19
|
+
var _ref = _usePersistedQuery["default"].getCache(scopedQueryKey) || {},
|
|
20
|
+
data = _ref.data,
|
|
21
|
+
modifiedAt = _ref.modifiedAt;
|
|
22
|
+
var expired = modifiedAt <= Date.now() - _constants.NEETO_APPS_LIST_STALE_TIME;
|
|
20
23
|
return (0, _usePersistedQuery["default"])(scopedQueryKey, _neeto_apps["default"].fetch, _objectSpread({
|
|
21
24
|
staleTime: _constants.NEETO_APPS_LIST_STALE_TIME,
|
|
22
|
-
enabled: (0, _neetoCist.isNotPresent)(
|
|
25
|
+
enabled: expired || (0, _neetoCist.isNotPresent)(data)
|
|
23
26
|
}, options));
|
|
24
27
|
};
|
|
25
28
|
var _default = useFetchNeetoApps;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFetchNeetoApps.js","names":["_neetoCist","require","_usePersistedQuery","_interopRequireDefault","_neeto_apps","_constants","_query","ownKeys","object","enumerableOnly","keys","Object","getOwnPropertySymbols","symbols","filter","sym","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","target","i","arguments","length","source","forEach","key","_defineProperty2","getOwnPropertyDescriptors","defineProperties","defineProperty","useFetchNeetoApps","options","_globalProps$user","scopedQueryKey","concat","QUERY_KEYS","NEETO_APPS_LIST","globalProps","user","id","
|
|
1
|
+
{"version":3,"file":"useFetchNeetoApps.js","names":["_neetoCist","require","_usePersistedQuery","_interopRequireDefault","_neeto_apps","_constants","_query","ownKeys","object","enumerableOnly","keys","Object","getOwnPropertySymbols","symbols","filter","sym","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","target","i","arguments","length","source","forEach","key","_defineProperty2","getOwnPropertyDescriptors","defineProperties","defineProperty","useFetchNeetoApps","options","_globalProps$user","scopedQueryKey","concat","QUERY_KEYS","NEETO_APPS_LIST","globalProps","user","id","_ref","usePersistedQuery","getCache","data","modifiedAt","expired","Date","now","NEETO_APPS_LIST_STALE_TIME","neetoAppsApi","fetch","staleTime","enabled","isNotPresent","_default","exports"],"sources":["../../../../src/react-utils/useFetchNeetoApps/useFetchNeetoApps.js"],"sourcesContent":["import { isNotPresent } from \"neetocist\";\nimport usePersistedQuery from \"react-utils/usePersistedQuery\";\n\nimport neetoAppsApi from \"./apis/neeto_apps\";\n\nimport { NEETO_APPS_LIST_STALE_TIME } from \"../constants\";\nimport { QUERY_KEYS } from \"../constants/query\";\n\nconst useFetchNeetoApps = options => {\n const scopedQueryKey = [\n `${QUERY_KEYS.NEETO_APPS_LIST}-${globalProps.user?.id}`,\n ];\n\n const { data, modifiedAt } = usePersistedQuery.getCache(scopedQueryKey) || {};\n const expired = modifiedAt <= Date.now() - NEETO_APPS_LIST_STALE_TIME;\n\n return usePersistedQuery(scopedQueryKey, neetoAppsApi.fetch, {\n staleTime: NEETO_APPS_LIST_STALE_TIME,\n enabled: expired || isNotPresent(data),\n ...options,\n });\n};\n\nexport default useFetchNeetoApps;\n"],"mappings":";;;;;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AACA,IAAAC,kBAA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A;EACnC,IAAMC,cAAc,GAAG,IAAAC,MAAA,CAClBC,iBAAU,CAACC,eAAe,OAAAF,MAAA,EAAAF,iBAAA,GAAIK,WAAW,CAACC,IAAI,cAAAN,iBAAA,uBAAhBA,iBAAA,CAAkBO,EAAE,EACtD;EAED,IAAAC,IAAA,GAA6BC,6BAAiB,CAACC,QAAQ,CAACT,cAAc,CAAC,IAAI,CAAC,CAAC;IAArEU,IAAI,GAAAH,IAAA,CAAJG,IAAI;IAAEC,UAAU,GAAAJ,IAAA,CAAVI,UAAU;EACxB,IAAMC,OAAO,GAAGD,UAAU,IAAIE,IAAI,CAACC,GAAG,EAAE,GAAGC,qCAA0B;EAErE,OAAO,IAAAP,6BAAiB,EAACR,cAAc,EAAEgB,sBAAY,CAACC,KAAK,EAAAhC,aAAA;IACzDiC,SAAS,EAAEH,qCAA0B;IACrCI,OAAO,EAAEP,OAAO,IAAI,IAAAQ,uBAAY,EAACV,IAAI;EAAC,GACnCZ,OAAO,EACV;AACJ,CAAC;AAAC,IAAAuB,QAAA,GAEaxB,iBAAiB;AAAAyB,OAAA,cAAAD,QAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bigbinary/neeto-commons-frontend",
|
|
3
|
-
"version": "4.3.
|
|
3
|
+
"version": "4.3.4",
|
|
4
4
|
"description": "A package encapsulating common code across neeto projects including initializers, utility functions, common components and hooks and so on.",
|
|
5
5
|
"repository": "git@github.com:bigbinary/neeto-commons-frontend.git",
|
|
6
6
|
"author": "Amaljith K <amaljith.k@bigbinary.com>",
|
|
@@ -9,10 +9,13 @@ import { QUERY_KEYS } from "../constants/query";
|
|
|
9
9
|
var useFetchNeetoApps = function useFetchNeetoApps(options) {
|
|
10
10
|
var _globalProps$user;
|
|
11
11
|
var scopedQueryKey = ["".concat(QUERY_KEYS.NEETO_APPS_LIST, "-").concat((_globalProps$user = globalProps.user) === null || _globalProps$user === void 0 ? void 0 : _globalProps$user.id)];
|
|
12
|
-
var
|
|
12
|
+
var _ref = usePersistedQuery.getCache(scopedQueryKey) || {},
|
|
13
|
+
data = _ref.data,
|
|
14
|
+
modifiedAt = _ref.modifiedAt;
|
|
15
|
+
var expired = modifiedAt <= Date.now() - NEETO_APPS_LIST_STALE_TIME;
|
|
13
16
|
return usePersistedQuery(scopedQueryKey, neetoAppsApi.fetch, _objectSpread({
|
|
14
17
|
staleTime: NEETO_APPS_LIST_STALE_TIME,
|
|
15
|
-
enabled:
|
|
18
|
+
enabled: expired || isNotPresent(data)
|
|
16
19
|
}, options));
|
|
17
20
|
};
|
|
18
21
|
export default useFetchNeetoApps;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFetchNeetoApps.js","names":["isNotPresent","usePersistedQuery","neetoAppsApi","NEETO_APPS_LIST_STALE_TIME","QUERY_KEYS","useFetchNeetoApps","options","_globalProps$user","scopedQueryKey","concat","NEETO_APPS_LIST","globalProps","user","id","
|
|
1
|
+
{"version":3,"file":"useFetchNeetoApps.js","names":["isNotPresent","usePersistedQuery","neetoAppsApi","NEETO_APPS_LIST_STALE_TIME","QUERY_KEYS","useFetchNeetoApps","options","_globalProps$user","scopedQueryKey","concat","NEETO_APPS_LIST","globalProps","user","id","_ref","getCache","data","modifiedAt","expired","Date","now","fetch","_objectSpread","staleTime","enabled"],"sources":["../../../src/react-utils/useFetchNeetoApps/useFetchNeetoApps.js"],"sourcesContent":["import { isNotPresent } from \"neetocist\";\nimport usePersistedQuery from \"react-utils/usePersistedQuery\";\n\nimport neetoAppsApi from \"./apis/neeto_apps\";\n\nimport { NEETO_APPS_LIST_STALE_TIME } from \"../constants\";\nimport { QUERY_KEYS } from \"../constants/query\";\n\nconst useFetchNeetoApps = options => {\n const scopedQueryKey = [\n `${QUERY_KEYS.NEETO_APPS_LIST}-${globalProps.user?.id}`,\n ];\n\n const { data, modifiedAt } = usePersistedQuery.getCache(scopedQueryKey) || {};\n const expired = modifiedAt <= Date.now() - NEETO_APPS_LIST_STALE_TIME;\n\n return usePersistedQuery(scopedQueryKey, neetoAppsApi.fetch, {\n staleTime: NEETO_APPS_LIST_STALE_TIME,\n enabled: expired || isNotPresent(data),\n ...options,\n });\n};\n\nexport default useFetchNeetoApps;\n"],"mappings":";;;AAAA,SAASA,YAAY;AACrB,OAAOC,iBAAiB;AAExB,OAAOC,YAAY;AAEnB,SAASC,0BAA0B;AACnC,SAASC,UAAU;AAEnB,IAAMC,iBAAiB,GAAG,SAApBA,iBAAiBA,CAAGC,OAAO,EAAI;EAAA,IAAAC,iBAAA;EACnC,IAAMC,cAAc,GAAG,IAAAC,MAAA,CAClBL,UAAU,CAACM,eAAe,OAAAD,MAAA,EAAAF,iBAAA,GAAII,WAAW,CAACC,IAAI,cAAAL,iBAAA,uBAAhBA,iBAAA,CAAkBM,EAAE,EACtD;EAED,IAAAC,IAAA,GAA6Bb,iBAAiB,CAACc,QAAQ,CAACP,cAAc,CAAC,IAAI,CAAC,CAAC;IAArEQ,IAAI,GAAAF,IAAA,CAAJE,IAAI;IAAEC,UAAU,GAAAH,IAAA,CAAVG,UAAU;EACxB,IAAMC,OAAO,GAAGD,UAAU,IAAIE,IAAI,CAACC,GAAG,EAAE,GAAGjB,0BAA0B;EAErE,OAAOF,iBAAiB,CAACO,cAAc,EAAEN,YAAY,CAACmB,KAAK,EAAAC,aAAA;IACzDC,SAAS,EAAEpB,0BAA0B;IACrCqB,OAAO,EAAEN,OAAO,IAAIlB,YAAY,CAACgB,IAAI;EAAC,GACnCV,OAAO,EACV;AACJ,CAAC;AAED,eAAeD,iBAAiB"}
|