Skip to content

fix(subtasks): use parent basename in Create subtask project link#1920

Open
SAY-5 wants to merge 1 commit into
callumalpass:mainfrom
SAY-5:fix-1912-subtask-basename
Open

fix(subtasks): use parent basename in Create subtask project link#1920
SAY-5 wants to merge 1 commit into
callumalpass:mainfrom
SAY-5:fix-1912-subtask-basename

Conversation

@SAY-5
Copy link
Copy Markdown

@SAY-5 SAY-5 commented May 21, 2026

Fixes #1912.

The "Create subtask" context menu pre-populated the new task's Projects field with the parent task's full vault path (e.g. `[[Tasks/Parent Task]]`), while every other entry point ("Add as Subtask", manual project assignment, the standalone task modal) writes the shortest unique link (`[[Parent Task]]`).

The regression was introduced when `buildSubtaskCreationPrePopulatedValues` was changed to use `buildStableFileLink` (which uses `file.path`). Switched back to `generateLink`, so the wikilink form goes through `metadataCache.fileToLinktext` like the rest of the codebase.

Added a regression test (`issue-1912-create-subtask-uses-parent-basename.test.ts`) and updated the existing `#1710` and `#1785` expectations that had locked in the wrong path.

Verified with `npx jest --testPathPatterns="1710|1785|1912|relationshipActions"` (12/12 pass), `npm run typecheck`, and `npm run lint:ts`.

The 'Create subtask' context menu was pre-populating the new task's
Projects field with the parent's full vault path (e.g.
[[Tasks/Parent Task]]) while every other entry point (the 'Add as
Subtask' command, manual project assignment, the standalone task
modal) writes the shortest unique link (e.g. [[Parent Task]]).

The mismatch was introduced when buildSubtaskCreationPrePopulatedValues
was refactored to use buildStableFileLink, which always uses file.path.
Switch back to generateLink so the wikilink form matches Obsidian's
shortest-unique convention via metadataCache.fileToLinktext.

Fixes callumalpass#1912
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]: "Create subtask" now inserts the full path of the parent task in Projects

1 participant