mirror of
https://github.com/BetterSEQTA/BetterSEQTA-Plus.git
synced 2026-06-05 19:24:39 +00:00
fix: storage always resetting to default
This commit is contained in:
@@ -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,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()
|
||||
|
||||
|
||||
@@ -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> {
|
||||
|
||||
Reference in New Issue
Block a user