Repository navigation
refactor(ui): reuse pathLeaf instead of local basename copies - #152
Merged
Merged
Conversation
App, Review, and Commits each inlined the same last-segment helper. Call the existing pathLeaf from repoIdentity and pin it against the deleted split/filter algorithm. Co-authored-by: Daniels <danielss-dev@users.noreply.github.com>
danielss-dev
marked this pull request as ready for review
October 22, 2026 16:23
…path-leaf-1995 Keep main's i18n import and the undo/drag graph behavior in Commits.tsx. Re-apply pathLeaf only for the two "Back to" labels. Co-authored-by: Daniels <danielss-dev@users.noreply.github.com>
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.
Problem
The same last-path-segment helper was copy-pasted in three UI files, while
pathLeafalready existed:ui/src/App.tsx— localbasenameviasplit(/[\\/]/).filter(Boolean)ui/src/views/Review.tsx— localbasenameviasplit(/[\\/]/).filter(Boolean).pop() ?? pui/src/views/Commits.tsx— the same split/filter/pop inline on the two "Back to" labelsui/src/lib/repoIdentity.ts(pathLeaf)After
filter(Boolean),[\\/]andpathLeaf's[\\/]+are equivalent.Solution
Delete the local copies and call
pathLeaf. No new helper, no rename sweep.Left alone on purpose:
FileView.tsxbasename only splits on/(git-relative paths); plugin-local copies (HeroiView, Quick Notes, Agent Session Recap) to keep this change small.Merged current
main(eddbe24) in. The only conflict was theCommits.tsximport: keeppathLeafand main'stimport fromi18n. Undo focus gating (data-git-undo-surface) and drag-and-drop (data-git-index) stay as they are on main.Files
ui/src/App.tsxui/src/views/Review.tsxui/src/views/Commits.tsxui/src/lib/repoIdentity.test.tsTests run
No Rust delta versus
main; CI Rust (ubuntu + macos) and clippy passed on the merge head.Risks
Display-only (progress subject, toast, icon-dialog fallback, review feedback repo name, "Back to …" bars). Empty/separator-only strings still return the original input, pinned by the pathLeaf tests.