Skip to content

Commit

Permalink
v1.5.1 fixes bug loading settings on new installs (#66)
Browse files Browse the repository at this point in the history
Co-authored-by: Steven Swartz <[email protected]>
  • Loading branch information
swar8080 and Steven Swartz authored May 28, 2023
1 parent 1ad2cfa commit 922228b
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 5 deletions.
2 changes: 1 addition & 1 deletion manifest-beta.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "obsidian-plugin-update-tracker",
"name": "Plugin Update Tracker",
"version": "1.5.0",
"version": "1.5.1",
"minAppVersion": "0.15.0",
"description": "Know when installed plugins have updates and evaluate the risk of upgrading",
"author": "Obsidian",
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "obsidian-plugin-update-tracker",
"name": "Plugin Update Tracker",
"version": "1.5.0",
"version": "1.5.1",
"minAppVersion": "0.15.0",
"description": "Know when installed plugins have updates and evaluate the risk of upgrading",
"author": "Obsidian",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "obsidian-plugin-update-tracker",
"version": "1.5.0",
"version": "1.5.1",
"description": "Know when installed plugins have updates and evaluate the risk of upgrading",
"main": "main.js",
"scripts": {
Expand Down
6 changes: 6 additions & 0 deletions src/domain/initiatePluginSettings.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ import initiatePluginSettings from './initiatePluginSettings';
import { DEFAULT_PLUGIN_SETTINGS, PluginSettings } from './pluginSettings';

describe('initiatePluginSettings', () => {
test('loading plugin for first time with null existing settings uses default settings', () => {
const settings = initiatePluginSettings(null);

expect(settings).toEqual(DEFAULT_PLUGIN_SETTINGS);
});

test('loading plugin for first time uses default settings', () => {
const settings = initiatePluginSettings({});

Expand Down
5 changes: 4 additions & 1 deletion src/domain/initiatePluginSettings.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import { DEFAULT_PLUGIN_SETTINGS, PluginSettings } from './pluginSettings';

export default function initiateSettings(savedSettings: Partial<PluginSettings>): PluginSettings {
export default function initiateSettings(
savedSettings: Partial<PluginSettings> | null
): PluginSettings {
savedSettings = savedSettings || {};
const migratedSettings: Partial<PluginSettings> = {};

if (
Expand Down
3 changes: 2 additions & 1 deletion versions.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@
"1.4.4": "0.15.0",
"1.4.5": "0.15.0",
"1.4.6": "0.15.0",
"1.5.0": "0.15.0"
"1.5.0": "0.15.0",
"1.5.1": "0.15.0"
}

0 comments on commit 922228b

Please sign in to comment.