fix: calendar disappeared for existing users

Shallow Object.assign on settings meant filterTags (new in 1.5.0) was
undefined for anyone with prior saved settings. Accessing .length on
undefined threw, killing the entire redraw before calendar could render.

- Defensive fallback: filterTags || []
- Deep merge on loadSettings for recentFiles, calendar, display
This commit is contained in:
2026-06-22 10:18:37 -04:00
parent abf4d6ccf7
commit 3c7b6741f5
5 changed files with 11 additions and 7 deletions
+4 -4
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -1,7 +1,7 @@
{ {
"id": "waypoint-sidebar", "id": "waypoint-sidebar",
"name": "Waypoint Sidebar", "name": "Waypoint Sidebar",
"version": "1.5.0", "version": "1.5.1",
"minAppVersion": "0.16.3", "minAppVersion": "0.16.3",
"description": "Calendar, recent files, and custom bookmarks sidebar.", "description": "Calendar, recent files, and custom bookmarks sidebar.",
"author": "Olivier", "author": "Olivier",
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "waypoint", "name": "waypoint",
"version": "1.5.0", "version": "1.5.1",
"description": "Calendar, recent files, and custom bookmarks sidebar.", "description": "Calendar, recent files, and custom bookmarks sidebar.",
"main": "main.js", "main": "main.js",
"scripts": { "scripts": {
+4
View File
@@ -199,6 +199,10 @@ export default class WaypointPlugin extends Plugin {
const saved = await this.loadData() as Record<string, unknown> | null; const saved = await this.loadData() as Record<string, unknown> | null;
const s = (saved?.settings || {}) as Partial<WaypointSettings>; const s = (saved?.settings || {}) as Partial<WaypointSettings>;
this.settings = Object.assign({}, DEFAULT_SETTINGS, s); this.settings = Object.assign({}, DEFAULT_SETTINGS, s);
// Deep merge nested objects that might be missing new fields
this.settings.recentFiles = Object.assign({}, DEFAULT_SETTINGS.recentFiles, s.recentFiles || {});
this.settings.calendar = Object.assign({}, DEFAULT_SETTINGS.calendar, s.calendar || {});
this.settings.display = Object.assign({}, DEFAULT_SETTINGS.display, s.display || {});
} }
async saveSettings(): Promise<void> { async saveSettings(): Promise<void> {
+1 -1
View File
@@ -241,7 +241,7 @@ export class WaypointView extends ItemView {
} }
// ── Type filter bar ── // ── Type filter bar ──
const configuredTags = this.plugin.settings.recentFiles.filterTags; const configuredTags = this.plugin.settings.recentFiles.filterTags || [];
let typeCounts: Record<string, number> = {}; let typeCounts: Record<string, number> = {};
if (configuredTags.length > 0) { if (configuredTags.length > 0) {