Skip to content

Commit

Permalink
fix(settings.ts): fix saveSettings method to correctly handle saving …
Browse files Browse the repository at this point in the history
…settings and only save if the value has changed
  • Loading branch information
anpigon committed Dec 29, 2023
1 parent d1c8c8a commit 546ed3e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@ export const DEFAULT_SETTINGS: SteemitPluginSettings = {
};

export class SteemitSettingTab extends PluginSettingTab {
plugin: SteemitPlugin;
private readonly plugin: SteemitPlugin;

constructor(app: App, plugin: SteemitPlugin) {
super(app, plugin);
this.plugin = plugin;
}

async saveSettings(name: keyof SteemitPluginSettings, value: string) {
if (this.plugin.settings) {
(this.plugin.settings as any)[name] = value;
async saveSettings(name: keyof SteemitPluginSettings, value: string | RewardType) {
if (this.plugin.settings && this.plugin.settings[name] !== value) {
this.plugin.settings[name] = value as RewardType;
await this.plugin.saveSettings();
}
}
Expand Down

0 comments on commit 546ed3e

Please sign in to comment.