@graphiql/toolkit
Advanced tools
Comparing version 0.7.2 to 0.7.3-canary-24a96ede.0
# @graphiql/toolkit | ||
## 0.7.3-canary-24a96ede.0 | ||
### Patch Changes | ||
- [#2755](https://github.com/graphql/graphiql/pull/2755) [`fcbfc7a9`](https://github.com/graphql/graphiql/commit/fcbfc7a9a31f365e958372f83ec4ea38ee6fab5b) Thanks [@thomasheyenbrock](https://github.com/thomasheyenbrock)! - Only remove namespaced items when clearing `localStorage` | ||
## 0.7.2 | ||
@@ -4,0 +10,0 @@ |
@@ -20,4 +20,14 @@ "use strict"; | ||
} | ||
else if (typeof window !== 'undefined') { | ||
this.storage = window.localStorage; | ||
this.storage.clear = function () { | ||
for (var key in window.localStorage) { | ||
if (key.indexOf("".concat(STORAGE_NAMESPACE, ":")) === 0) { | ||
window.localStorage.removeItem(key); | ||
} | ||
} | ||
}; | ||
} | ||
else { | ||
this.storage = typeof window !== 'undefined' ? window.localStorage : null; | ||
this.storage = null; | ||
} | ||
@@ -24,0 +34,0 @@ } |
@@ -17,4 +17,14 @@ function isQuotaError(storage, e) { | ||
} | ||
else if (typeof window !== 'undefined') { | ||
this.storage = window.localStorage; | ||
this.storage.clear = () => { | ||
for (const key in window.localStorage) { | ||
if (key.indexOf(`${STORAGE_NAMESPACE}:`) === 0) { | ||
window.localStorage.removeItem(key); | ||
} | ||
} | ||
}; | ||
} | ||
else { | ||
this.storage = typeof window !== 'undefined' ? window.localStorage : null; | ||
this.storage = null; | ||
} | ||
@@ -21,0 +31,0 @@ } |
{ | ||
"name": "@graphiql/toolkit", | ||
"version": "0.7.2", | ||
"version": "0.7.3-canary-24a96ede.0", | ||
"description": "Utility to build a fetcher for GraphiQL", | ||
@@ -5,0 +5,0 @@ "contributors": [ |
@@ -63,5 +63,14 @@ /** | ||
this.storage = null; | ||
} else if (typeof window !== 'undefined') { | ||
this.storage = window.localStorage; | ||
// We only want to clear the namespaced items | ||
this.storage.clear = () => { | ||
for (const key in window.localStorage) { | ||
if (key.indexOf(`${STORAGE_NAMESPACE}:`) === 0) { | ||
window.localStorage.removeItem(key); | ||
} | ||
} | ||
}; | ||
} else { | ||
// When passing `undefined` we default to localStorage | ||
this.storage = typeof window !== 'undefined' ? window.localStorage : null; | ||
this.storage = null; | ||
} | ||
@@ -68,0 +77,0 @@ } |
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
301695
3962