Skip to content

Empty note close does not reliably delete note #4514

@ComputelessComputer

Description

@ComputelessComputer

Closing an empty note tab does not reliably delete the backing session.

Also reproduces when closing the currently active tab, not just other close flows.

Likely cause: isSessionEmpty(...) in apps/desktop/src/store/tinybase/store/sessions.ts determines editor emptiness by serializing TipTap JSON to markdown with json2md(...). Some visually blank editor states serialize as non-empty strings, for example:

  • empty paragraph ->  
  • empty bullet list -> -  
  • empty task list -> - [ ]  

The current logic only special-cases  , so blank notes in empty list/task-list states are treated as non-empty and skipped by close-tab cleanup.

Expected:
Closing a visually empty note should consistently delete it regardless of its empty TipTap structure.

Suggested fix:
Use TipTap structural emptiness checks (isEmptyTiptapContent(...)) on parsed JSON instead of markdown serialization for the primary emptiness gate, with string fallback only for legacy raw content.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions