fix(links): strip subpaths when resolving link targets - #738
Merged
michaelpporter merged 2 commits intoJul 25, 2026
Merged
Conversation
michaelpporter
force-pushed
the
731-bug-inline-dataview-creates-unintended-self-loop-edge
branch
from
July 25, 2026 15:28
c3b318e to
2bbfac9
Compare
michaelpporter
force-pushed
the
734-bug-tree-view-fails-for-links-with-block-references
branch
from
July 25, 2026 15:28
9387c66 to
3bd6d01
Compare
This was referenced Jul 25, 2026
Base automatically changed from
731-bug-inline-dataview-creates-unintended-self-loop-edge
to
main
July 25, 2026 15:49
`down:: [[2#^71f2d9]]` in 1.md resolved to a phantom "2#^71f2d9.md" node, so 1.md's tree rendered but 2.md never gained the reverse `up` edge — node identity in the graph is the resolved path string, and the transitive rule attached the reverse to the phantom. resolve_relative_target_path now drops everything from the first `#` before resolving (`#` is illegal in vault filenames), fixing the frontmatter and inline typed_link passes plus list_note in one place. A subpath-only link ([[#^71f2d9]]) targets the source note itself, so it now yields no edge instead of a self-loop. Refs #734
The button asked for `absolute bottom-2 right-2`, but src/styles.css imports only `tailwindcss/utilities` — in Tailwind v4 the numeric spacing scale lives in the theme layer, so `bottom-2`, `right-2` and the `pr-10` content padding all compiled to nothing. An absolutely positioned element with no insets sits at its static position, putting the button over the first row's collapse arrow. Positions the button (and the row padding that keeps note flair clear of it) with plain CSS against Obsidian's --size-4-* variables, so it no longer depends on the missing Tailwind scale. Scoped to the tree codeblock. The wider problem — 99 spacing utilities across 15 files silently compiling to nothing — is left untouched here. Refs #736
michaelpporter
force-pushed
the
734-bug-tree-view-fails-for-links-with-block-references
branch
from
July 25, 2026 15:51
219d60a to
ccb9690
Compare
michaelpporter
deleted the
734-bug-tree-view-fails-for-links-with-block-references
branch
July 25, 2026 15:52
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.
Refs #734 — intentionally not an auto-closing keyword; the issue is closed when the fix ships in a release.
Problem
down:: [[2#^71f2d9]]in1.mdresolved to a phantom2#^71f2d9.mdnode. Node identity in the WASM graph is the resolved path string, so2.mdand2#^71f2d9.mdare two different nodes — thedown→uptransitive rule hung the reverse edge off the phantom.That produces exactly the asymmetry reported:
1.md's tree renders fine, while2.mdnever shows1.mdas its parent.Root cause:
resolve_relative_target_pathpassed the raw link text togetFirstLinkpathDest, which rejects anything carrying a#subpath, so the link fell through to the unresolved-path fallback.Fix
Strip everything from the first
#before resolving.#is illegal in vault filenames, so the first one always starts a subpath.This is a single chokepoint — it fixes both
typed_linkpasses (frontmatter and inline) andlist_note, which had the same latent bug, and works regardless of which folders the notes live in.A subpath-only link (
[[#^71f2d9]]) points into the source note itself, so it now yields no edge rather than a self-loop.Tests
bun run build && bun run testpass (379 tests, 0 type errors).New
tests/utils/obsidian.test.ts. The mock'sgetFirstLinkpathDestreturnsnullfor anything containing#, matching the real API — that's what makes these tests meaningful rather than tautological. Covers: block ref, heading ref, cross-folder block ref, block ref to a non-existent note, subpath-only link, and.canvas#group.