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 $path variable to commits.query.graphql and pass currentPath from the app component

Single source of truth for file path:

  • commit_list_app captures the path once in created() and owns it as state
  • commit_list_header and commit_list_breadcrumb receive the path via filePath prop instead of reading $route.params.path directly

Route watcher for navigation:

  • Added a $route.params.path watcher in commit_list_app so 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.path is undefined and the route has no matches, the current file path is preserved

References

Screenshots

How to set up and validate locally

  1. Enable the feature flag

    Feature.enable(:project_commits_refactor)
  2. Navigate to a file history page, e.g. /<project>/-/commits/main/README.md

  3. Verify only commits for that file are shown

  4. Switch to a different branch using the ref selector

  5. Verify the file path is preserved and commits are still filtered

  6. Click a breadcrumb segment (e.g. a parent directory) and verify the path updates correctly and commits reload for the new path

  7. Navigate to a nested file path, e.g. /<project>/-/commits/main/app/models/user.rb

  8. Click a breadcrumb segment to navigate to a parent folder and confirm the commit list updates

  9. 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.

Edited by Chaoyue Zhao

Merge request reports

Loading