fix(subtasks): use parent basename in Create subtask project link#1920
Open
SAY-5 wants to merge 1 commit into
Open
fix(subtasks): use parent basename in Create subtask project link#1920SAY-5 wants to merge 1 commit into
SAY-5 wants to merge 1 commit into
Conversation
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
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.
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`.