[go: up one dir, main page]

Skip to content

Ensure File Tree Navigation works with Paginated Results

Problem

When navigating to deep paths like /files/ruby/popen.rb, the file tree fails if parent directories (files) exist on later pages that haven't been loaded yet.

Example: Root directory has 2000 items, backend limits to 100 per page. If files directory is item # 1500, navigation to /files/ruby/popen.rb fails because we only load page 1.

Current Behavior

  1. User navigates to /files/ruby/popen.rb
  2. Component loads first page of root directory (items 1-100)
  3. files directory not found (it's on page 15)
  4. Navigation fails

Potential solution 1 (frontend)

When navigating to a deep path, automatically fetch additional pages until all parent directories are found:

  1. Start navigation to /files/ruby/popen.rb
  2. Load first page of root directory
  3. If files not found, fetch next page
  4. Repeat until files directory is found or no more pages

This ensures navigation works regardless of where directories appear in the pagination sequence.

⚠️ since we'll be recursively fetching the pages, it might put unnecessary load on the backend, especially for large repos with deeply nested directories.

Potential solution 2 (UX)

Implement something similar to what we have on the MR page, where the linked file is displayed at the top of the list:

Screenshot

Screenshot_2025-06-18_at_13.11.25

  • Discuss this with UX
  • Document the expected behaviour

Result

  • Deep linking works for any valid path
  • Automatically handles backend pagination limits
  • Graceful fallback for invalid paths
  • No breaking changes to existing functionality
Edited by 🤖 GitLab Bot 🤖