fix(bases): parse generated normalized relationship filter for task defaults (#2043)#2044
Draft
kudrmax wants to merge 1 commit into
Draft
fix(bases): parse generated normalized relationship filter for task defaults (#2043)#2044kudrmax wants to merge 1 commit into
kudrmax wants to merge 1 commit into
Conversation
…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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 insrc/templates/defaultBasesFiles.ts) normalizes each project link before comparing, producing:normalizeFilterPropertycannot reduce that prefix to the field nameprojects, so it returnsnull, noprojectsdefault is applied, and the created task immediately drops out of the view.Change
applyFilterRuleDefaultnow detects the normalizedlist(note.PROP).map(...).contains(this.file.asLink())form (with an optional... &&prefix) and recovers the wrapped property via the existingnormalizeFilterProperty(which already unwrapslist(...)andnote./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 throughfieldMapper).Tests
Added two regression tests in
tests/unit/bases/basesFilterDefaults.test.ts:projectsfrom the exact generated Subtasks filter;projectsfield mapping for the same shape.npx jest tests/unit/bases/passes (39 suites, 232 tests). Pre-existing typecheck errors about a build-generated../releaseNotesmodule are unrelated to this change.