Skip to content

Commit

Permalink
chore: prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
louisgv committed Jun 18, 2024
1 parent f3aa1bd commit 13c5f3c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 12 deletions.
10 changes: 4 additions & 6 deletions src/hook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ type Setter<T> = ((v?: T, isHydrated?: boolean) => T) | T
export type RawKey =
| string
| {
key: string
instance: BaseStorage
}
key: string
instance: BaseStorage
}

/**
* https://docs.plasmo.com/framework/storage
Expand Down Expand Up @@ -54,12 +54,10 @@ export function useStorage<T = any>(rawKey: RawKey, onInit?: Setter<T>) {

const key = isObjectKey ? rawKey.key : rawKey

const [isLoading, setIsLoading] = useState(true);

// Render state
const [renderValue, setRenderValue] = useState(onInit)
const [isLoading, setIsLoading] = useState(true)

// Use to ensure we don't set render state after unmounted
const isMounted = useRef(false)

Expand Down
10 changes: 5 additions & 5 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export type StorageArea = chrome.storage.StorageArea
export type InternalStorage = typeof chrome.storage

export type SerdeOptions = {
serializer: <T>(value: T) => string,
serializer: <T>(value: T) => string
deserializer: <T>(rawValue: string) => T
}

Expand Down Expand Up @@ -120,7 +120,7 @@ export abstract class BaseStorage {
if (this.hasWebApi && (allCopied || copiedKeyList.length > 0)) {
this.#secondaryClient = window.localStorage
}
} catch { }
} catch {}

try {
if (this.hasExtensionApi) {
Expand All @@ -135,7 +135,7 @@ export abstract class BaseStorage {
this.#primaryClient = this.#extStorageEngine[this.area]
}
}
} catch { }
} catch {}
}

setCopiedKeySet(keyList: string[]) {
Expand Down Expand Up @@ -175,8 +175,8 @@ export abstract class BaseStorage {
const dataMap = this.allCopied
? await this.rawGetAll()
: await this.#primaryClient.get(
(syncAll ? [...this.copiedKeySet] : [key]).map(this.getNamespacedKey)
)
(syncAll ? [...this.copiedKeySet] : [key]).map(this.getNamespacedKey)
)

if (!dataMap) {
return false
Expand Down
2 changes: 1 addition & 1 deletion src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const isChromeBelow100 = () => {
return (
parseInt(browserMatch[2]) < 100 ||
globalThis.chrome.runtime?.getManifest()?.manifest_version === 2
);
)
}
} catch {
return false
Expand Down

0 comments on commit 13c5f3c

Please sign in to comment.