@tanstack/query-sync-storage-persister
Advanced tools
Comparing version 5.0.0-alpha.5 to 5.0.0-alpha.6
@@ -9,5 +9,6 @@ import type { PersistedClient, Persister, PersistRetryer } from '@tanstack/query-persist-client-core'; | ||
/** The storage client used for setting and retrieving items from cache. | ||
* For SSR pass in `undefined`. | ||
* For SSR pass in `undefined`. Note that window.localStorage can be | ||
* `null` in Android WebViews depending on how they are configured. | ||
*/ | ||
storage: Storage | undefined; | ||
storage: Storage | undefined | null; | ||
/** The key to use when storing the cache */ | ||
@@ -14,0 +15,0 @@ key?: string; |
@@ -9,3 +9,3 @@ function createSyncStoragePersister({ | ||
}) { | ||
if (typeof storage !== 'undefined') { | ||
if (storage) { | ||
const trySave = persistedClient => { | ||
@@ -26,3 +26,3 @@ try { | ||
errorCount++; | ||
client = retry?.({ | ||
client = retry == null ? void 0 : retry({ | ||
persistedClient: client, | ||
@@ -29,0 +29,0 @@ error, |
@@ -11,3 +11,3 @@ 'use strict'; | ||
}) { | ||
if (typeof storage !== 'undefined') { | ||
if (storage) { | ||
const trySave = persistedClient => { | ||
@@ -28,3 +28,3 @@ try { | ||
errorCount++; | ||
client = retry?.({ | ||
client = retry == null ? void 0 : retry({ | ||
persistedClient: client, | ||
@@ -31,0 +31,0 @@ error, |
@@ -15,3 +15,3 @@ (function (global, factory) { | ||
}) { | ||
if (typeof storage !== 'undefined') { | ||
if (storage) { | ||
const trySave = persistedClient => { | ||
@@ -18,0 +18,0 @@ try { |
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).QuerySyncStoragePersister={})}(this,(function(e){"use strict";function t(e,t=100){let r,n=null;return function(...i){r=i,null===n&&(n=setTimeout((()=>{e(...r),n=null}),t))}}function r(){}e.createSyncStoragePersister=function({storage:e,key:n="REACT_QUERY_OFFLINE_CACHE",throttleTime:i=1e3,serialize:o=JSON.stringify,deserialize:s=JSON.parse,retry:l}){if(void 0!==e){const r=t=>{try{return void e.setItem(n,o(t))}catch(e){return e}};return{persistClient:t((e=>{let t=e,n=r(t),i=0;for(;n&&t;)i++,t=l?.({persistedClient:t,error:n,errorCount:i}),t&&(n=r(t))}),i),restoreClient:()=>{const t=e.getItem(n);if(t)return s(t)},removeClient:()=>{e.removeItem(n)}}}return{persistClient:r,restoreClient:()=>{},removeClient:r}}})); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).QuerySyncStoragePersister={})}(this,(function(e){"use strict";function t(e,t=100){let r,n=null;return function(...i){r=i,null===n&&(n=setTimeout((()=>{e(...r),n=null}),t))}}function r(){}e.createSyncStoragePersister=function({storage:e,key:n="REACT_QUERY_OFFLINE_CACHE",throttleTime:i=1e3,serialize:o=JSON.stringify,deserialize:s=JSON.parse,retry:l}){if(e){const r=t=>{try{return void e.setItem(n,o(t))}catch(e){return e}};return{persistClient:t((e=>{let t=e,n=r(t),i=0;for(;n&&t;)i++,t=l?.({persistedClient:t,error:n,errorCount:i}),t&&(n=r(t))}),i),restoreClient:()=>{const t=e.getItem(n);if(t)return s(t)},removeClient:()=>{e.removeItem(n)}}}return{persistClient:r,restoreClient:()=>{},removeClient:r}}})); | ||
//# sourceMappingURL=index.production.js.map |
{ | ||
"name": "@tanstack/query-sync-storage-persister", | ||
"version": "5.0.0-alpha.5", | ||
"version": "5.0.0-alpha.6", | ||
"description": "A persister for synchronous storages, to be used with TanStack/Query", | ||
@@ -31,3 +31,3 @@ "author": "tannerlinsley", | ||
"dependencies": { | ||
"@tanstack/query-persist-client-core": "5.0.0-alpha.5" | ||
"@tanstack/query-persist-client-core": "5.0.0-alpha.6" | ||
}, | ||
@@ -34,0 +34,0 @@ "scripts": { |
@@ -15,5 +15,6 @@ import type { | ||
/** The storage client used for setting and retrieving items from cache. | ||
* For SSR pass in `undefined`. | ||
* For SSR pass in `undefined`. Note that window.localStorage can be | ||
* `null` in Android WebViews depending on how they are configured. | ||
*/ | ||
storage: Storage | undefined | ||
storage: Storage | undefined | null | ||
/** The key to use when storing the cache */ | ||
@@ -46,3 +47,3 @@ key?: string | ||
}: CreateSyncStoragePersisterOptions): Persister { | ||
if (typeof storage !== 'undefined') { | ||
if (storage) { | ||
const trySave = (persistedClient: PersistedClient): Error | undefined => { | ||
@@ -49,0 +50,0 @@ try { |
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
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
44949
605
+ Added@tanstack/query-core@5.0.0-alpha.6(transitive)
+ Added@tanstack/query-persist-client-core@5.0.0-alpha.6(transitive)
- Removed@tanstack/query-core@5.0.0-alpha.5(transitive)
- Removed@tanstack/query-persist-client-core@5.0.0-alpha.5(transitive)