-
Notifications
You must be signed in to change notification settings - Fork 848
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: preload fuze and full files tree #239
Conversation
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/vscode-github1s/github1s/9ajQ4cw2rMzv1sVAVPjVmhiiDx3C |
16cb8f7
to
bdb1abc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure whether it's this PR that causes the issue:
The app is calling the API twice: https://api.github.com/repos/conwnet/github1s/git/trees/HEAD:
And if we could call it with recursive=1
, in theory. There should not be any extra call to get the directory.
I understand sometime the call with recursive=1
might be slow, calling the API to get first-level directories/files would speed up the file tree view. I suggest we try to remove the addition API call like https://api.github.com/repos/conwnet/github1s/git/trees/HEAD:
reproduce link: https://github1s-git-feature-preload-tree-vscode-github1s.vercel.app/conwnet/github1s
Please feel free to merge this PR if you think we should deal with the race network call in another PR.
Confirmed the double API calls is not related to this PR, it happens on latest master https://github1s-jkn7hfhgo-vscode-github1s.vercel.app/ |
Thank you so much for your infomation. The double api calls on request without the param Another reason I don't use the the response: {
sha: '...',
url: '...',
tree: [...],
truncated: true // truncated
} |
Now, if the user open a repository in GitHub1s, it will only fetch the first level files. (In order to display the content faster)
And when the user press
Ctrl/Command + P
, it will use therecursive=true
param ofget-a-tree
API to fetch all files, then populate the files into the fileSystemProvider's cache:github1s/extensions/github1s/src/providers/fileSearchProvider.ts
Line 60 in e079f7a
So if we haven't ever press the
Ctrl/Commond + P
, we need make aget-a-tree
request every time you open a new folder, which is slow and waste.I think we can fetch the full files tree sliently after the page loaded. Although it may waste a request, but it's will not to create a new request when the user opens another folder.
Related API: https://docs.github.com/en/rest/reference/git#get-a-tree