fix: storage always resetting to default

This commit is contained in:
SethBurkart123
2025-04-03 22:24:25 +11:00
parent 1c9e361f78
commit d52a59ae48
3 changed files with 6 additions and 4 deletions
+3
View File
@@ -1,4 +1,5 @@
import {
initializeSettingsState,
settingsState,
} from "@/seqta/utils/listeners/SettingsState"
import documentLoadCSS from "@/css/documentload.scss?inline"
@@ -38,6 +39,8 @@ async function init() {
icon.href = icon48 // Change the icon
try {
await initializeSettingsState()
if (typeof settingsState.onoff === "undefined") {
browser.runtime.sendMessage({ type: "setDefaultStorage" })
}
-3
View File
@@ -3,7 +3,6 @@ import browser from "webextension-polyfill"
// Internal utilities and functions
import {
initializeSettingsState,
settingsState,
} from "@/seqta/utils/listeners/SettingsState"
@@ -16,8 +15,6 @@ import injectedCSS from "@/css/injected.scss?inline"
export async function main() {
return new Promise(async (resolve, reject) => {
try {
await initializeSettingsState()
if (settingsState.onoff) {
injectPageState()
+3 -1
View File
@@ -70,7 +70,9 @@ class StorageManager {
private async loadFromStorage(): Promise<void> {
const result = await browser.storage.local.get();
this.data = { ...this.data, ...result };
Object.entries(result).forEach(([key, value]) => {
Reflect.set(this.data, key, value);
});
}
private async saveToStorage(): Promise<void> {