@mantine/hooks
Advanced tools
Comparing version 7.1.5 to 7.2.0-alpha.0
@@ -55,3 +55,3 @@ 'use client'; | ||
key, | ||
defaultValue = void 0, | ||
defaultValue, | ||
getInitialValueInEffect = true, | ||
@@ -63,3 +63,9 @@ deserialize = deserializeJSON, | ||
(skipStorage) => { | ||
if (typeof window === "undefined" || !(type in window) || window[type] === null || skipStorage) { | ||
let storageBlockedOrSkipped; | ||
try { | ||
storageBlockedOrSkipped = typeof window === "undefined" || !(type in window) || window[type] === null || !!skipStorage; | ||
} catch (_e) { | ||
storageBlockedOrSkipped = true; | ||
} | ||
if (storageBlockedOrSkipped) { | ||
return defaultValue; | ||
@@ -117,7 +123,3 @@ } | ||
}, []); | ||
return [ | ||
value === void 0 ? defaultValue : value, | ||
setStorageValue, | ||
removeStorageValue | ||
]; | ||
return [value === void 0 ? defaultValue : value, setStorageValue, removeStorageValue]; | ||
}; | ||
@@ -124,0 +126,0 @@ } |
@@ -14,2 +14,2 @@ export type StorageType = 'localStorage' | 'sessionStorage'; | ||
} | ||
export declare function createStorage<T>(type: StorageType, hookName: string): ({ key, defaultValue, getInitialValueInEffect, deserialize, serialize, }: StorageProperties<T>) => readonly [T | undefined, (val: T | ((prevState: T) => T)) => void, () => void]; | ||
export declare function createStorage<T>(type: StorageType, hookName: string): ({ key, defaultValue, getInitialValueInEffect, deserialize, serialize, }: StorageProperties<T>) => [T, (val: T | ((prevState: T) => T)) => void, () => void]; |
import { StorageProperties } from './create-storage'; | ||
export declare function useLocalStorage<T = string>(props: StorageProperties<T>): readonly [T | undefined, (val: T | ((prevState: T) => T)) => void, () => void]; | ||
export declare function useLocalStorage<T = string>(props: StorageProperties<T>): [T, (val: T | ((prevState: T) => T)) => void, () => void]; |
import { StorageProperties } from '../use-local-storage/create-storage'; | ||
export declare function useSessionStorage<T = string>(props: StorageProperties<T>): readonly [T | undefined, (val: T | ((prevState: T) => T)) => void, () => void]; | ||
export declare function useSessionStorage<T = string>(props: StorageProperties<T>): [T, (val: T | ((prevState: T) => T)) => void, () => void]; |
{ | ||
"name": "@mantine/hooks", | ||
"version": "7.1.5", | ||
"version": "7.2.0-alpha.0", | ||
"main": "./cjs/index.js", | ||
@@ -5,0 +5,0 @@ "types": "./lib/index.d.ts", |
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
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
536872
5354
1