From ab7e15e9e43a6fbca78d4ee3319bfb256b8a2c93 Mon Sep 17 00:00:00 2001 From: Brendan Early Date: Tue, 25 Jun 2024 19:58:35 -0500 Subject: [PATCH 1/4] Try to prevent issues if chrome.storage.get unexpectedly returns undefined --- src/models/settings.ts | 4 ++-- src/store/Accounts.ts | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/models/settings.ts b/src/models/settings.ts index ae793e76..f40cb2e1 100644 --- a/src/models/settings.ts +++ b/src/models/settings.ts @@ -153,7 +153,7 @@ export class UserSettings { ? StorageLocation.Local : storageLocation; const storageData: UserSettingsData = - (await chrome.storage[location].get("UserSettings")).UserSettings || {}; + (await chrome.storage[location].get("UserSettings"))?.UserSettings || {}; delete storageData[key]; UserSettings.items = storageData; @@ -163,7 +163,7 @@ export class UserSettings { private static async getStorageData(location: StorageLocation) { const storageData: UserSettingsData = - (await chrome.storage[location].get("UserSettings")).UserSettings || {}; + (await chrome.storage[location].get("UserSettings"))?.UserSettings || {}; return storageData; } diff --git a/src/store/Accounts.ts b/src/store/Accounts.ts index 22c00b1a..2a6bd0bf 100644 --- a/src/store/Accounts.ts +++ b/src/store/Accounts.ts @@ -480,8 +480,10 @@ export class Accounts implements Module { newStorageLocation === StorageLocation.Sync ) { const localData = await chrome.storage.local.get(); - delete localData.UserSettings; - await chrome.storage.sync.set(localData); + if (localData?.UserSettings) { + delete localData.UserSettings; + await chrome.storage.sync.set(localData); + } const syncData = await chrome.storage.sync.get(); // Double check if data was set From 8a3240823ce692ba98e06e376b009ac0894dfa83 Mon Sep 17 00:00:00 2001 From: Brendan Early Date: Tue, 25 Jun 2024 20:15:33 -0500 Subject: [PATCH 2/4] pin version of mujo-code/puppeteer-headful --- .github/workflows/main.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e9e90435..a51e367a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -42,7 +42,7 @@ jobs: run-tests: runs-on: ubuntu-latest name: Run tests - needs: [ build ] + needs: [build] steps: - uses: actions/checkout@v2 @@ -53,9 +53,9 @@ jobs: - name: Install dependencies run: npm ci env: - PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: 'true' + PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: "true" - name: Test code - uses: mujo-code/puppeteer-headful@master + uses: mujo-code/puppeteer-headful@18.9.0 with: args: npm test From e902d86de0f71e33acc63e10d2f0c1c0d5a2293c Mon Sep 17 00:00:00 2001 From: Brendan Early Date: Tue, 25 Jun 2024 20:21:08 -0500 Subject: [PATCH 3/4] Test fix for puppeteer issues --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index a51e367a..071ccb53 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -56,6 +56,6 @@ jobs: PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: "true" - name: Test code - uses: mujo-code/puppeteer-headful@18.9.0 + uses: mymindstorm/puppeteer-headful@5cdb4b90ae90e67cefb14e867d35c7b73693adac with: args: npm test From 12f8291e0e860d32b2250ca8a57e5084b84322db Mon Sep 17 00:00:00 2001 From: Brendan Early Date: Tue, 25 Jun 2024 20:39:40 -0500 Subject: [PATCH 4/4] update CI action --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 071ccb53..c4e2793f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -56,6 +56,6 @@ jobs: PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: "true" - name: Test code - uses: mymindstorm/puppeteer-headful@5cdb4b90ae90e67cefb14e867d35c7b73693adac + uses: mymindstorm/puppeteer-headful@8f745c770f7f4c0f9f332d7c43a775f90e53779a with: args: npm test