@plasmicapp/query
Advanced tools
Comparing version 0.1.3 to 0.1.4
@@ -27,3 +27,3 @@ 'use strict'; | ||
}; | ||
}); | ||
}, []); | ||
var callback = React.useCallback(function () { | ||
@@ -96,3 +96,16 @@ if (mountedRef.current) { | ||
cache[key].data = data; | ||
if (!suspense) { | ||
forceUpdate(); | ||
} | ||
return data; | ||
})["catch"](function (err) { | ||
cache[key].error = err; | ||
if (!suspense) { | ||
forceUpdate(); | ||
} | ||
throw err; | ||
}); | ||
@@ -99,0 +112,0 @@ cache[key] = { |
@@ -1,2 +0,2 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=(e=require("react"))&&"object"==typeof e&&"default"in e?e.default:e,r=t.createContext({cache:{},suspense:!1}),n=t.createContext(void 0);exports.PlasmicQueryDataProvider=function(e){var n=e.children,u=e.suspense,a=e.prefetchedCache,o=t.useState(a?Object.fromEntries(Object.entries(a).map((function(e){return[e[0],{data:e[1]}]}))):{})[0],s=t.useMemo((function(){return{cache:o,suspense:u}}),[o,u]);return t.createElement(r.Provider,{value:s},n)},exports.PrepassContext=n,exports.usePlasmicQueryData=function(e,u){var a,o,s,c=t.useContext(n),i=t.useContext(r),f=(o=t.useState({})[1],s=t.useRef(!1),t.useEffect((function(){return s.current=!0,function(){s.current=!1}})),t.useCallback((function(){s.current&&o({})}),[o,s])),l=null!=(a=null==c?void 0:c.cache)?a:null==i?void 0:i.cache,d=!!c||(null==i?void 0:i.suspense);if(e in l){var p=l[e],v=p.promise,h=p.data,x=p.error;if(h)return{data:h};if(x){if(d)throw x;return{error:x}}if(v){if(d)throw v;return v.then(f),{}}}var m=u().then((function(t){return l[e].data=t,t}));if(l[e]={promise:m},d)throw m;return{}}; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=(e=require("react"))&&"object"==typeof e&&"default"in e?e.default:e,r=t.createContext({cache:{},suspense:!1}),n=t.createContext(void 0);exports.PlasmicQueryDataProvider=function(e){var n=e.children,u=e.suspense,a=e.prefetchedCache,o=t.useState(a?Object.fromEntries(Object.entries(a).map((function(e){return[e[0],{data:e[1]}]}))):{})[0],c=t.useMemo((function(){return{cache:o,suspense:u}}),[o,u]);return t.createElement(r.Provider,{value:c},n)},exports.PrepassContext=n,exports.usePlasmicQueryData=function(e,u){var a,o,c,s=t.useContext(n),i=t.useContext(r),f=(o=t.useState({})[1],c=t.useRef(!1),t.useEffect((function(){return c.current=!0,function(){c.current=!1}}),[]),t.useCallback((function(){c.current&&o({})}),[o,c])),l=null!=(a=null==s?void 0:s.cache)?a:null==i?void 0:i.cache,d=!!s||(null==i?void 0:i.suspense);if(e in l){var p=l[e],h=p.promise,v=p.data,x=p.error;if(v)return{data:v};if(x){if(d)throw x;return{error:x}}if(h){if(d)throw h;return h.then(f),{}}}var m=u().then((function(t){return l[e].data=t,d||f(),t})).catch((function(t){throw l[e].error=t,d||f(),t}));if(l[e]={promise:m},d)throw m;return{}}; | ||
//# sourceMappingURL=query.cjs.production.min.js.map |
@@ -21,3 +21,3 @@ import React from 'react'; | ||
}; | ||
}); | ||
}, []); | ||
var callback = React.useCallback(function () { | ||
@@ -90,3 +90,16 @@ if (mountedRef.current) { | ||
cache[key].data = data; | ||
if (!suspense) { | ||
forceUpdate(); | ||
} | ||
return data; | ||
})["catch"](function (err) { | ||
cache[key].error = err; | ||
if (!suspense) { | ||
forceUpdate(); | ||
} | ||
throw err; | ||
}); | ||
@@ -93,0 +106,0 @@ cache[key] = { |
{ | ||
"version": "0.1.3", | ||
"version": "0.1.4", | ||
"license": "MIT", | ||
@@ -7,4 +7,3 @@ "main": "dist/index.js", | ||
"files": [ | ||
"dist", | ||
"src" | ||
"dist" | ||
], | ||
@@ -11,0 +10,0 @@ "engines": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
40089
12
292