Skip to content

Commit

Permalink
fix: object settings now save properly
Browse files Browse the repository at this point in the history
  • Loading branch information
Tormak9970 committed May 6, 2024
1 parent 3c3734c commit bf054d8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ tauri-build = { version = "1.5.1", features = [] }
[dependencies]
serde_json = "1.0"
serde = { version = "1.0", features = ["derive"] }
tauri = { version = "1.6.1", features = ["dialog-all", "fs-all", "http-request", "os-all", "path-all", "process-exit", "process-relaunch", "protocol-all", "reqwest-client", "shell-open", "updater", "window-all", "devtools"] }
tauri = { version = "1.6.1", features = ["devtools", "dialog-all", "fs-all", "http-request", "os-all", "path-all", "process-exit", "process-relaunch", "protocol-all", "reqwest-client", "shell-open", "updater", "window-all"] }
tauri-plugin-single-instance = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "dev" }
chrono = "0.4.34"
home = "0.5.9"
Expand Down
16 changes: 8 additions & 8 deletions src/lib/controllers/SettingsController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,21 +109,21 @@ export class SettingsController {
this.hiddenGameIdsSub = hiddenGameIds.subscribe((newIds) => {
if (JSON.stringify(newIds) !== JSON.stringify(this.oldHiddenGameIds)) {
SettingsManager.updateSetting("hiddenGameIds", newIds);
this.oldHiddenGameIds = newIds;
this.oldHiddenGameIds = structuredClone(newIds);
}
});

this.manualSteamGamesSub = manualSteamGames.subscribe((newGames) => {
if (JSON.stringify(newGames) !== JSON.stringify(this.oldManualSteamGames)) {
SettingsManager.updateSetting("manualSteamGames", newGames);
this.oldManualSteamGames = newGames;
this.oldManualSteamGames = structuredClone(newGames);
}
});

this.customGameNamesSub = customGameNames.subscribe((newGameNames) => {
if (JSON.stringify(newGameNames) !== JSON.stringify(this.oldCustomGameNames)) {
SettingsManager.updateSetting("customGameNames", newGameNames);
this.oldCustomGameNames = newGameNames;
this.oldCustomGameNames = structuredClone(newGameNames);
}
});

Expand Down Expand Up @@ -154,7 +154,7 @@ export class SettingsController {
this.dbFiltersSub = dbFilters.subscribe((newFilters) => {
if (JSON.stringify(newFilters) !== JSON.stringify(this.oldDbFilters)) {
SettingsManager.updateSetting("windowSettings.main.filters", newFilters);
this.oldDbFilters = newFilters;
this.oldDbFilters = structuredClone(newFilters);
}
});

Expand Down Expand Up @@ -297,19 +297,19 @@ export class SettingsController {
*/
private loadNicheSettings(): void {
const manualSteamGamesSetting = SettingsManager.getSetting<GameStruct[]>("manualSteamGames");
this.oldManualSteamGames = manualSteamGamesSetting;
this.oldManualSteamGames = structuredClone(manualSteamGamesSetting);
if (manualSteamGamesSetting.length > 0) {
manualSteamGames.set(manualSteamGamesSetting);
LogController.log(`Loaded ${manualSteamGamesSetting.length} manually added games.`);
}

const customGameNamesSetting = SettingsManager.getSetting<Record<string, string>>("customGameNames");
this.oldCustomGameNames = customGameNamesSetting;
this.oldCustomGameNames = structuredClone(customGameNamesSetting);
customGameNames.set(customGameNamesSetting);
LogController.log(`Loaded ${Object.keys(customGameNamesSetting).length} custom game names.`);

const hiddenGameIdsSetting = SettingsManager.getSetting<number[]>("hiddenGameIds");
this.oldHiddenGameIds = hiddenGameIdsSetting;
this.oldHiddenGameIds = structuredClone(hiddenGameIdsSetting);
hiddenGameIds.set(hiddenGameIdsSetting);
}

Expand All @@ -326,7 +326,7 @@ export class SettingsController {
showHidden.set(showHiddenGamesSetting);

const dbFiltersSetting = SettingsManager.getSetting<DBFilters>("windowSettings.main.filters");
this.oldDbFilters = dbFiltersSetting;
this.oldDbFilters = structuredClone(dbFiltersSetting);
dbFilters.set(dbFiltersSetting);

const gridTypeSetting = SettingsManager.getSetting<string>("windowSettings.main.type") as GridTypes;
Expand Down

0 comments on commit bf054d8

Please sign in to comment.