Skip to content

fix(bases): parse generated normalized relationship filter for task defaults (#2043)#2044

Draft
kudrmax wants to merge 1 commit into
callumalpass:mainfrom
kudrmax:fix/2043-bases-filter-defaults-list-map
Draft

fix(bases): parse generated normalized relationship filter for task defaults (#2043)#2044
kudrmax wants to merge 1 commit into
callumalpass:mainfrom
kudrmax:fix/2043-bases-filter-defaults-list-map

Conversation

@kudrmax

@kudrmax kudrmax commented Jun 18, 2026

Copy link
Copy Markdown

Summary

Fixes the default Subtasks "+" button not assigning the current project (see #2043). This is a follow-up to #1657: the filter-defaults parser added in 4.8.0 handles simple user-authored filters, but not the more complex filter that TaskNotes generates by default for relationship views.

Problem

Creating a task via the column "+" button derives the new task's frontmatter from the view filter through extractBasesFilterDefaults. The default Subtasks relationship view (generated in src/templates/defaultBasesFiles.ts) normalizes each project link before comparing, producing:

file.hasLink(this.file) && list(note.projects).map(file(value.replace(/^\[[^\]]+\]\((.*)\)$/, "$1").replace(/%20/g, " ")).asLink()).contains(this.file.asLink())

normalizeFilterProperty cannot reduce that prefix to the field name projects, so it returns null, no projects default is applied, and the created task immediately drops out of the view.

Change

applyFilterRuleDefault now detects the normalized list(note.PROP).map(...).contains(this.file.asLink()) form (with an optional ... && prefix) and recovers the wrapped property via the existing normalizeFilterProperty (which already unwraps list(...) and note./task.). The current note link is then pre-filled as the project, so the new task stays in the view.

The change is targeted: it only triggers on the list(...).map(...).contains(this.file.asLink()) shape and falls through to the existing generic matcher otherwise. Field mapping is respected (the property is resolved through fieldMapper).

Tests

Added two regression tests in tests/unit/bases/basesFilterDefaults.test.ts:

  • extracts projects from the exact generated Subtasks filter;
  • honors a custom projects field mapping for the same shape.

npx jest tests/unit/bases/ passes (39 suites, 232 tests). Pre-existing typecheck errors about a build-generated ../releaseNotes module are unrelated to this change.

…efaults

The default Subtasks relationship view generates a filter of the form
  file.hasLink(this.file) && list(note.projects).map(...).contains(this.file.asLink())
which the filter-defaults parser could not reduce to a field name, so new
tasks created via the column "+" button got no projects value and dropped
out of the view.

Detect the normalized list/map form explicitly and recover the wrapped
property so the current note is pre-filled as the project.

Refs callumalpass#2043
@kudrmax kudrmax marked this pull request as draft June 18, 2026 10:03
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.

1 participant