refactor: BacklinkSource に displayName / displayPath field を追加 (#239)#252
Merged
Merged
Conversation
- scanBacklinksImpl で workspacePath / sourceFile から 1 度だけ計算する scan-time hoist field を追加し、BacklinkPanel.tsx の毎-render basename / toRelativePath 呼び出しを削減 - main 側 toDisplayPath は entry-filter.ts:toRel と同じ Node 標準 relative + posix 正規化 pattern を採用 (renderer 側 toRelativePath の手書き再実装を回避) - e2e mock (electron-api-mock.ts:scanBacklinks) も対称に対応 - backlink.test.ts に mkSource helper を追加し 7 sites を集約 (将来の BacklinkSource field 追加時の touch point を 1 箇所化) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This was referenced Jun 27, 2026
ymnao
added a commit
that referenced
this pull request
Jun 28, 2026
#254) - IPC 境界 type に UnresolvedWikilinkReference extends WikilinkReference { displayPath: string } を追加 - scanUnresolvedWikilinksImpl で file 単位 hoist で displayPath を 1 度だけ算出 (PR #252 BacklinkSource と同 pattern) - UnresolvedLinksPanel の per-render toRelativePath 計算を削除し reference.displayPath を直接読み - e2e mock の displayPath 計算 (scanUnresolvedWikilinks / scanBacklinks の 2 箇所) を mockDisplayPath helper に集約 (/simplify Reuse 採用) - test mock 1 site に displayPath 追加 Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5 tasks
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.
概要
BacklinkSource(IPC 境界 type) にdisplayName/displayPathを追加し、scanBacklinksImplで workspacePath / sourceFile から 1 度だけ計算して payload に乗せる。BacklinkPanel.tsxの毎 renderbasename/toRelativePath計算 (per-source × per-render) を scan-time hoist で削減する Issue #239 Option A 実装。関連 Issue
closes #239
移行 Stage
(該当 stage なし — IPC payload 最適化 / quick win refactor)
変更内容
src/types/wikilink.ts:BacklinkSourceにdisplayName: string/displayPath: string追加 (scan-time hoist 済 derived field、意図をコメントで明示)electron/main/ipc/search.ts:scanBacklinksImplのresult.pushでbasename(sourceFile)/toDisplayPath(workspacePath, sourceFile)を計算して埋めるtoDisplayPathは main 側entry-filter.ts:toRelと同じnode:path.relative+seppattern を採用 (renderer 側src/lib/path.ts:toRelativePathの手書き再実装を回避)src/components/search/BacklinkPanel.tsx:basename/toRelativePath計算を削除しsrc.displayName/src.displayPathを直接読むtoRelativePathを削除e2e/helpers/electron-api-mock.ts:scanBacklinksmock の return shape を本番と対称に拡張 (addInitScript制約で import 不可なため inline 実装)src/stores/backlink.test.ts:mkSource(sourceFile, references = [])helper を追加し 7 sites の mock data を集約 (将来のBacklinkSourcefield 追加時の touch point を 1 箇所化)動作確認
vitest run全 2230 test pass / 0 fail (98 test files)tsc --noEmit3 config clean (node / web / e2e)biome checkclean (既存 biome.json deprecation 2 infos のみ、本 PR 差分起因なし)/code-review low(none) — production hunk 3 file に runtime bug 該当なし/simplify4 reviewer 並列: 採用 2 件 (toDisplayPathを Noderelative()+sepベースに簡略化、backlink.test.tsをmkSourcehelper 化)、見送り 6 件スクリーンショット
(UI 変更なし)