-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Use frontend fetch for branch dropdown component #25719
Conversation
fetchBranchesOrTags: onInputDebounce(async function() { | ||
const resp = await fetch(`${this.repoLink}/${this.mode}/list`); | ||
const {results} = await resp.json(); |
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.
Should we perhaps cache the result?
So that we only query it once instead of whenever the user opens the selector?
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 guess if we do caching, we should do it in a fetch wrapper shared for all fetches, and likely opt-in per consumer.
Ideally, I'd like to see a swr-like caching strategy, but it must not be tied to any framework like Vue.
caefc88
to
99dc28c
Compare
For the filter step, I did some tests trying to figure out why sometimes the input get stuck, and I found that if use native svg instead of I am wondering if this is a proper way to improve this component (change Demo (At the end of the following demos, I was deleting input at a constant speed, but the one with use Untitled.movuse native svg.mov |
|
Updated description and the PR is ready for review now. |
I think this does highlight a inefficiency in the BTW, which solution did you settle on here? |
Now I guess the real question is why There appears to be |
Now I used native |
I think we need a better solution because if that octicon changes, this icon will not update if you embed it like that. Also, if we manage to fix How to reproduce the performance issue? Just type into the branch dropdown with many branches present? |
To reproduce: prepare thousands of branches Possible solutions:
|
e9273a0
to
0f0b9ec
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.
The merge is incorrect. It loses some fixes from #25875
Done in 0ec8fd5 |
Away from keyboard at the moment, feel free to dismiss my request change |
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.
dismiss request change
* giteaoffical/main: (22 commits) Serve pre-defined files in "public", add "security.txt", add CORS header for ".well-known" (go-gitea#25974) Use frontend fetch for branch dropdown component (go-gitea#25719) Remove commit status running and warning from the dashboard repo list (go-gitea#26036) Refactor to use urfave/cli/v2 (go-gitea#25959) Remove commit status running and warning to align GitHub (go-gitea#25839) Fix escape problems in the branch selector (go-gitea#25875) Update README.md to fix the broken link of Hugo (go-gitea#26008) Support copy protected branch from template repository (go-gitea#25889) Update JS dependencies (go-gitea#26025) Reduce margins on admin pages (go-gitea#26026) Actions Artifacts support uploading multiple files and directories (go-gitea#24874) [skip ci] Updated translations via Crowdin Remove redundant "RouteMethods" method (go-gitea#26024) Adding remaining enum for migration repo model type. (go-gitea#26021) RPM Registry: Show zypper commands for SUSE based distros as well (go-gitea#25981) Fix the route for pull-request's authors (go-gitea#26016) Remove nfnt/resize and oliamb/cutter (go-gitea#25999) Correctly refer to dev tags as nightly in the docker docs (go-gitea#26004) Fix env config parsing for "GITEA____APP_NAME" (go-gitea#26001) Add file status for API "Get a single commit from a repository" (go-gitea#16205) (go-gitea#25831) ...
The public repositories' branch list dropdown will return wrong because it requires login wrongly. Caused by #25719
Send request to get branch/tag list, use loading icon when waiting for response.
Only fetch when the first time branch/tag list shows.
For backend, removed assignment to
ctx.Data["Branches"]
andctx.Data["Tags"]
fromcontext/repo.go
and passed these data wherever needed.Changed some
v-if
tov-show
and used nativesvg
as mentioned in Use frontend fetch for branch dropdown component #25719 (comment) to improve perfomance when there are a lot of branches.Places Used the dropdown component:
Repo Home Page
Commits Page
Specific commit -> operations -> cherry-pick
Release Page
Demo
Untitled.mov
Note:
UI of dropdown menu could be improved in another PR as it should apply to more dropdown menus.
Fix #14180