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
- User navigates to
/files/ruby/popen.rb - Component loads first page of root directory (items 1-100)
-
filesdirectory not found (it's on page 15) - Navigation fails
Potential solution 1 (frontend)
When navigating to a deep path, automatically fetch additional pages until all parent directories are found:
-
Start navigation to
/files/ruby/popen.rb - Load first page of root directory
-
If
filesnot found, fetch next page -
Repeat until
filesdirectory is found or no more pages
This ensures navigation works regardless of where directories appear in the pagination sequence.
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:
-
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
