Skip to content

Daily Journal tab restores a stale date from persisted tab state #3836

Closed

Description

@mstomar125

What happens

On launch the app restores the persisted tab state from webview localStorage verbatim. The Daily Journal tab (id: "daily-journal") is persisted with a fixed nodeId (a date). On any later day it reopens on that old date instead of today. Observed on a real Mac: Daily Journal opened on August 24, 2026 on 2026-10-13, and the user's typed nodes were created under date 2026-08-24.

Cause

  • packages/desktop-app/src/lib/stores/navigation.svelte.ts: createInitialTabState() builds the daily-journal tab with nodeId: getTodayDateId() only when nothing is persisted. loadPersistedState() (called from app-shell.svelte onMount) replaces state with the TabPersistenceService.load() output unchanged.
  • tab-persistence-service.ts stores it in localStorage['nodespace:tab-state'].
  • loadPersistedState() does not re-resolve the Daily Journal tab to today, so the tab keeps whatever date was open when the state was last saved (also if the user paged with the arrows).
  • The tab title shows the raw date rather than "Today", consistent with a restored tab.
  • The daemon creates the date node for whatever id the viewer asks for, which is why new nodes went under the old date.

Webview storage lives in ~/Library/WebKit/com.nodespace.desktop/..., so wiping ~/.nodespace does not reset it. Reproduced on a developer Mac: that localstorage.sqlite3 held {"version":1,"tabs":[{"id":"daily-journal","title":"2026-06-01","type":"node","content":{"nodeId":"2026-06-01","nodeType":"date"},...}]...}, which would open June 1.

Expected

After restoring, a Daily Journal tab (id === DAILY_JOURNAL_TAB_ID, content.nodeType === 'date') whose nodeId is not today (local date) is rewritten to today, with the title updated to match. A date tab that is not the Daily Journal is untouched. Optionally keep the restored date only if the app was last used the same calendar day.

Acceptance criteria

  • Unit test in tests/stores/navigation*.test.ts: a persisted daily-journal tab dated in the past shows today after load; a non-daily-journal date tab is untouched.
  • Midnight rollover (app left open overnight) considered separately, noted in the PR if not handled.

Why it matters

New entries land on an old date page, confusing, and it affects every user after the first day for the default tab.

Where

packages/desktop-app/src/lib/stores/navigation.svelte.ts (loadPersistedState), tab-persistence-service.ts.

Activity

  1. self-assigned this
    on Oct 16, 2026
  2. added
    bug
    on Oct 16, 2026
  3. mstomar125 commented on Oct 20, 2026

    @mstomar125
    ContributorAuthor

    Planned for core v0.3.9.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions