Skip to content
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

Issue page: "Authors" drop-down loads ALL authors and their avatars #22586

Closed
drsybren opened this issue Jan 23, 2023 · 6 comments · Fixed by #23890
Closed

Issue page: "Authors" drop-down loads ALL authors and their avatars #22586

drsybren opened this issue Jan 23, 2023 · 6 comments · Fixed by #23890
Labels
performance/bigrepo Performance Issues affecting Big Repositories topic/ui Change the appearance of the Gitea UI type/enhancement An improvement of existing functionality
Milestone

Comments

@drsybren
Copy link
Contributor

Description

The "Authors" drop-down on the repo issues page (so on the /{owner}/{repo}/issues URL) has HTML elements for all authors, and will load all of their avatars. This does not use a virtual DOM, this does not wait until the drop-down is actually opened, this happens immediately on page load.

I'm one of the Blender developers tasked with porting our data from https://developer.blender.org/ to Gitea. My local Gitea database holds 33164 users, 4 organizations, 44 repositories, 93035 issues, 731996 comments, and 749 labels. The list of "issue authors" in the Blender repository has 24919 items.

The culprit is templates/repo/issue/list.tmpl, which has this snippet in the "Authors" drop-down code:

{{range .Posters}}
	<a class="{{if eq $.PosterID .ID}}active selected{{end}} item" href="{{$.Link}}?type={{$.ViewType}}&sort={{$.SortType}}&state={{$.State}}&labels={{$.SelectLabels}}&milestone={{$.MilestoneID}}&project={{$.ProjectID}}&assignee={{$.AssigneeID}}&poster={{.ID}}">
		{{avatar .}} {{.GetDisplayName}}
	</a>
{{end}}

That .Posters list is thus 24919 items long, and it generates an <a> tag with an <img> tag for every single one of them.

You can see this on any issues page, for example https://try.gitea.io/orgddfafgsjj/rep/pulls

Screenshots

image

Gitea Version

29b78bc

Can you reproduce the bug on the Gitea demo site?

Yes

Operating System

No response

Browser Version

Firefox 109.0

@drsybren drsybren added type/bug topic/ui Change the appearance of the Gitea UI labels Jan 23, 2023
@delvh delvh added this to the 1.19.0 milestone Jan 23, 2023
@silverwind
Copy link
Member

silverwind commented Jan 24, 2023

I think this is a limitation of Fomantic UI Dropdown. What should probably be done is to create these dropdowns with tippy.js and find a way to lazy-load and/or paginate the user dropdowns.

@silverwind silverwind added type/enhancement An improvement of existing functionality and removed type/bug labels Jan 24, 2023
@yardenshoham yardenshoham added the performance/bigrepo Performance Issues affecting Big Repositories label Jan 24, 2023
@lunny
Copy link
Member

lunny commented Jan 29, 2023

I think this is a limitation of Fomantic UI Dropdown. What should probably be done is to create these dropdowns with tippy.js and find a way to lazy-load and/or paginate the user dropdowns.

I don't think paginate is necessary, maybe a search box with limited results i.e. 10 or 20 is better.

@silverwind
Copy link
Member

Paginate with a infinite on-scroll loader would be ideal I guess. Problem with limited filter is that if you search common terms, some valuable results may become hidden from view.

@lunny
Copy link
Member

lunny commented Jan 30, 2023

Paginate with a infinite on-scroll loader would be ideal I guess. Problem with limited filter is that if you search common terms, some valuable results may become hidden from view.

I know it can be implemented. But it's really unnecessary to do that. If we want to at somebody, we will remember his name or copy his name. Searching a in that box is meaningless. And take a look at Github, it will list about 20 or 30 authors and there is also no pagination.

@drsybren
Copy link
Contributor Author

Please keep in mind that we have some short names as well. Searching for “Ton” should have Ton at the top. We’ve had this as an issue with other systems, just want to avoid seeing the same issue here.

@silverwind
Copy link
Member

Yeah that is what I was getting at. If you only know "John" first name and there are 50 Johns, you have a problem with a limited display number.

@delvh delvh added the outdated/backport/v1.19 This PR should be backported to Gitea 1.19 label Feb 22, 2023
@delvh delvh modified the milestones: 1.19.0, 1.20.0 Feb 22, 2023
@lunny lunny removed the outdated/backport/v1.19 This PR should be backported to Gitea 1.19 label Apr 3, 2023
lunny pushed a commit that referenced this issue Apr 7, 2023
…ng wait time) (#23890)

Right now the authors search dropdown might take a long time to load if
amount of authors is huge.
Example: (In the video below, there are about 10000 authors, and it
takes about 10 seconds to open the author dropdown)

https://user-images.githubusercontent.com/17645053/229422229-98aa9656-3439-4f8c-9f4e-83bd8e2a2557.mov

Possible improvements can be made, which will take 2 steps (Thanks to
@wolfogre for advice):

Step 1:
Backend: Add a new api, which returns a limit of 30 posters with matched
prefix.
Frontend: Change the search behavior from frontend search(fomantic
search) to backend search(when input is changed, send a request to get
authors matching the current search prefix)

Step 2:
Backend: Optimize the api in step 1 using indexer to support fuzzy
search.

This PR is implements the first step. The main changes:
1. Added api: `GET /{type:issues|pulls}/posters` , which return a limit
of 30 users with matched prefix (prefix sent as query). If
`DEFAULT_SHOW_FULL_NAME` in `custom/conf/app.ini` is set to true, will
also include fullnames fuzzy search.
2. Added a tooltip saying "Shows a maximum of 30 users" to the author
search dropdown
3. Change the search behavior from frontend search to backend search

After:

https://user-images.githubusercontent.com/17645053/229430960-f88fafd8-fd5d-4f84-9df2-2677539d5d08.mov

Fixes: #22586

---------

Co-authored-by: wxiaoguang <[email protected]>
Co-authored-by: silverwind <[email protected]>
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
performance/bigrepo Performance Issues affecting Big Repositories topic/ui Change the appearance of the Gitea UI type/enhancement An improvement of existing functionality
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants