Skip to content

Commit

Permalink
fix: removeAll should account for namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
louisgv committed Apr 16, 2024
1 parent 4f5a1ca commit e38313a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@plasmohq/storage",
"version": "1.9.3",
"version": "1.10.0",
"description": "Safely and securely store data and share them across your extension and websites",
"type": "module",
"module": "./src/index.ts",
Expand Down
11 changes: 6 additions & 5 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,9 @@ export abstract class BaseStorage {
return changed
}

protected rawGet = async (key: string): Promise<string | null | undefined> => {
protected rawGet = async (
key: string
): Promise<string | null | undefined> => {
if (this.hasExtensionApi) {
const dataMap = await this.#primaryClient.get(key)

Expand Down Expand Up @@ -233,11 +235,10 @@ export abstract class BaseStorage {
}

removeAll = async () => {
// Using rawGetAll to retrieve all keys with namespace
const allData = await this.rawGetAll()
const allData = await this.getAll()
const keyList = Object.keys(allData)

await Promise.all(keyList.map(this.rawRemove))
await Promise.all(keyList.map(this.remove))
}

watch = (callbackMap: StorageCallbackMap) => {
Expand All @@ -255,7 +256,7 @@ export abstract class BaseStorage {
callbackSet.add(callbackMap[cbKey])

if (callbackSet.size > 1) {
continue;
continue
}

const chromeStorageListener = (
Expand Down

0 comments on commit e38313a

Please sign in to comment.