@tanstack/query-sync-storage-persister
Advanced tools
Comparing version 4.27.0 to 4.27.1
@@ -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 => { | ||
@@ -12,0 +12,0 @@ try { |
@@ -13,3 +13,3 @@ 'use strict'; | ||
}) { | ||
if (typeof storage !== 'undefined') { | ||
if (storage) { | ||
const trySave = persistedClient => { | ||
@@ -16,0 +16,0 @@ try { |
@@ -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=null==l?void 0: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}},Object.defineProperty(e,"__esModule",{value:!0})})); | ||
!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=null==l?void 0: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}},Object.defineProperty(e,"__esModule",{value:!0})})); | ||
//# sourceMappingURL=index.production.js.map |
{ | ||
"name": "@tanstack/query-sync-storage-persister", | ||
"version": "4.27.0", | ||
"version": "4.27.1", | ||
"description": "A persister for synchronous storages, to be used with TanStack/Query", | ||
@@ -5,0 +5,0 @@ "author": "tannerlinsley", |
@@ -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
44938
569