Wire file path filtering to refactored commit list frontend
What does this MR do and why?
Wire the path GraphQL argument (added in !233654 (merged)) into the refactored Vue commit list so file history views only show commits touching that file.
What changed
Path as GraphQL variable:
- Add
$pathvariable tocommits.query.graphqland passcurrentPathfrom the app component
Single source of truth for file path:
commit_list_appcaptures the path once increated()and owns it as statecommit_list_headerandcommit_list_breadcrumbreceive the path viafilePathprop instead of reading$route.params.pathdirectly
Route watcher for navigation:
- Added a
$route.params.pathwatcher incommit_list_appso the file path updates reactively when the user navigates (e.g. clicking a breadcrumb segment) - The watcher guards against unmatched routes (e.g. after switching refs to a branch/tag not in the router's static routes) — when
params.pathisundefinedand the route has no matches, the current file path is preserved
References
- Backend: !233654 (merged)
- Issue: #598435
Screenshots
How to set up and validate locally
-
Enable the feature flag
Feature.enable(:project_commits_refactor) -
Navigate to a file history page, e.g.
/<project>/-/commits/main/README.md -
Verify only commits for that file are shown
-
Switch to a different branch using the ref selector
-
Verify the file path is preserved and commits are still filtered
-
Click a breadcrumb segment (e.g. a parent directory) and verify the path updates correctly and commits reload for the new path
-
Navigate to a nested file path, e.g.
/<project>/-/commits/main/app/models/user.rb -
Click a breadcrumb segment to navigate to a parent folder and confirm the commit list updates
-
Use the ref selector to switch to a tag — verify the file path is preserved and commits are still filtered
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.