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)
-
files
directory not found (it's on page 15) - Navigation fails
frontend)
Potential solution 1 (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
files
not found, fetch next page -
Repeat until
files
directory is found or no more pages
This ensures navigation works regardless of where directories appear in the pagination sequence.
UX)
Potential solution 2 (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