web: improve prefetch file blob
Created by: valerybugakov
Context
This PR makes sure:
- We have a consistent
fetchBlob
cache key. - We do not prefetch blob on keyboard navigation if the experiment flag is not enabled.
- We do not call the
fetchBlob
function for the go-up-the-file-tree link on hover.
https://github.com/sourcegraph/sourcegraph/pull/40354 follow-up.
Test plan
- Run the application with the enabled experimental flag
enableSidebarFilePrefetch
. - Open the blob page.
- Navigate between blobs using the keyboard up and down arrows.
- Notice that
fetchBlob
requests are issued once per selected/visited file. No requests are issued when the go-up-the-file-tree link is selected.
App preview:
Check out the client app preview documentation to learn more.