Skip to content

fix(bases): use isEmpty() for generated emptiness checks (#2524) - #2525

Merged
callumalpass merged 1 commit into
mainfrom
fix/2524-tracking-status-isempty
Nov 9, 2026
Merged

callumalpass merged 1 commit into
mainfrom
fix/2524-tracking-status-isempty

Conversation

@callumalpass

Copy link
Copy Markdown
Owner

Fixes #2524 (reported by @dsebastien).

Problem

In Obsidian Bases, !prop and list(prop).length evaluate to null (not true / 0) when the property is missing or blank. The generated trackingStatus formula used !time_entries || list(time_entries).length == 0, so tasks without a time_entries property never showed "Not started".

Changes

  • src/templates/defaultBasesFiles.ts: trackingStatus now uses time_entries.isEmpty(). The "No estimate" test in trackingStatus and timeEstimateCategory is now timeEstimate.isEmpty() || timeEstimate == 0. That test already worked because of its == null fallback; it now uses the same form as the other checks. Neither property is a checkbox, so isEmpty() is safe here.
  • src/services/BasesFilterConverter.ts: the saved-view exporter turned "is []" into (!prop || prop.length == 0), which had the same bug. It now produces prop.isEmpty(). The array branch only handles list values; booleans are handled elsewhere.
  • Docs: default-base-templates.md showed the broken forms, including projectCount/contextCount, which the generator no longer uses. Updated to the new forms.
  • Release note includes the manual fix for existing vaults.

Existing vaults

TaskNotes does not migrate existing .base files. On startup ensureDefaultBasesViewFiles only creates missing files. Overwriting is opt-in, through Settings → Views & base files → Update files or the Update default base files command, and it replaces manual edits. So existing users keep the old formula until they use Update files or edit trackingStatus by hand. The release note covers both options.

Testing

  • Unit: tests/unit/issues/issue-2524-tracking-status-isempty.test.ts checks the generated formula text, checks that no generated formula uses !prop ||, and checks the exporter. It fails on main and passes here.
  • E2E (isolated Obsidian): e2e/issues/issue-2524-tracking-status-isempty.spec.ts builds a table base over notes with entries/estimate missing, null, []/0, and set. The old entries formula gives "some" for the missing and null cases; isEmpty() gives "none". The new estimate test gives the same results as the old one.
  • npm run lint, typecheck, npm test (6058 passed; one earlier run had a single failure that did not reproduce on rerun), i18n:check, docs:check, build, check:bundle-size.

In Bases, `!prop` and `list(prop).length` evaluate to null when a
property is missing or blank, so trackingStatus never returned
"Not started" for tasks without time entries. Use isEmpty() in
trackingStatus and timeEstimateCategory, and in the saved-view
exporter's empty-list filter.
@callumalpass
callumalpass merged commit 59ac91c into main Nov 9, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: trackingStatus never shows "Not started" in the generated Bases views (!prop is null for a missing property)

1 participant