-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Improve reviewing PR UX #19612
Improve reviewing PR UX #19612
Conversation
This comment was marked as off-topic.
This comment was marked as off-topic.
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 do not think mixing jQuery and native JS together is a good idea.
And the native code is so long, the code itself is wordy and the comments are also wordy .....
It's just a matter of getting used to it. It'll still perform much better than any jQuery-equivalent code. |
Does the performance really matter or can you feel it? C perform better than Go , WASM also does better performance, do they make sense to be used? |
@wxiaoguang I'd say it is a tradeoff of the benefit versus the associated cost: Additionally, the documentation of the native DOM API is quite extensive and regularly updated (i.e. MDN), while the documentation of JQuery can be quite sparse (for example, when I searched for the meaning of Also, if we would manage to get rid of JQuery, the total frontend download size might decrease, and our frontend will have one fewer possible point of failure (i.e. the JQuery mirror going offline for some reason) But this whole discussion is irrelevant for this PR, and I think we both know how we think about this issue. |
There have been a lot of discussions before.
Well, you just heard of it. Can you show how it makes Gitea UI better without jQuery? Or how jQuery makes Gitea UI slow?
How could it be spare? Isn't it on https://api.jquery.com and written very clearly? Won't you still read the MDN if you write native JS?
My question is: since Fomantic UI still exists, how can you get rid of jQuery? If you can not get rid of it, why you want to mix the jQuery code with native JS code together? Any benefit? My belief is: show real evidences, make feasible plans, write the executable and clear code, instead of guessing and imagining. |
Let's not diverge again into the jQuery vs native discussion. Both approaches are fine currently, and I personally have no issues with mixing them either. |
This PR DOES mix them together. A lot of native code are added into the jQuery code context. And I would against for the re-inventing wheels behavior. (Why you want to write the If you want a new PR wihout any jQuery context (for example, a separate Vue component), I would say nothing. |
And we have written guildelines. If the guideline is incorrect, please improve it to keep Gitea code base clear and maintainable. I never want to see a 4000 line index.js with mixed native/jQuery/Vue together again. |
Often times it's beneficial from a DRY point of view to variablize CSS values so they can be shared for other rules, but in this specific case, there's not much use to that as it's a very specific duration. |
Co-authored-by: silverwind <[email protected]>
Co-authored-by: silverwind <[email protected]>
I don't mind refactoring this file to remove jQuery. I can only write native javascript(especially when trying out different approaches to a problem). jQuery would still require me to lookup docs/current code in Gitea to implement it correctly. If it's a really must, I don't mind changing my current code to jQuery. But then this approach to implement this feature should be settled before then. |
You are in a jQuery context, and you are using jQuery, why not keep using it? As I said before, I would against for mixing different frameworks together, it only make code messy and unmaintainable. If a JS module is written from scratch without Fomantic UI & jQuery dependency, then it's free to use its own framework. If a JS feature is written inside jQuery context, I can not imagine a reason why not keep using jQuery. |
routers/web/repo/pull.go
Outdated
ctx.Data["PendingCodeComments"] = numPendingCodeComments | ||
ctx.PageData["prReview"] = map[string]interface{}{ | ||
"pendingCodeComments": numPendingCodeComments, | ||
} |
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.
Hmm ... it's duplicated. I think we can use data-xxx
to pass the template data to JS in this case.
I made a refactoring demo, you can take what you like. Some thoughts:
And there are still some bugs, the counter number could be incorrect in some cases. For example, if the network is broken before form submit, you would see the number go high incorrectly (to the moon). This problem is caused by some more fundamental problems in Gitea frontend (messy logic, bad designs, bad codes), so it's not a blocker for this PR. Just because there were so many bad designs and bad codes before, I spent a lot of time refactoring the frontend code. So what I am doing now is trying to make Gitea have a better frontend code base and benefits all developers in the future. And I really hope everyone (especially people with frontend experiences) can work together to make Gitea frontend better. ps: Although you said "can only write native javascript & need to look up docs for jQuery)", that's true for anyone about "I can only write A & need to look up docs for B" (A=Golang, B=JavaScript, etc). jQuery is simple enough and it won't waste you more than 30 minutes to understand how it works. Since Gitea was and is using jQuery heavily, I think you should know and learn it, just like you should learn your enemy before any fight. |
I write jQuery on a monthly basis, much of the specifics will be forgotten by then. The 30 minutes of looking everything up is more or less a repeated task every time I want to convert my javascript code to jQuery code. |
make lgtm work |
This PR has done what it should do, it's enough. Some hints about how to make the comment counting part better (for future readers)
|
* giteaofficial/main: Delete related PullAutoMerge and ReviewState on User/Repo Deletion (go-gitea#19649) Allow custom default merge message with .gitea/default_merge_message/<merge_style>_TEMPLATE.md (go-gitea#18177) Allow to mark files in a PR as viewed (go-gitea#19007) Auto merge pull requests when all checks succeeded via API (go-gitea#9307) Hide private repositories in packages (go-gitea#19584) Only show accessible teams in dashboard dropdown list (go-gitea#19642) prevent double click new issue/pull/comment button (go-gitea#16157) Improve reviewing PR UX (go-gitea#19612) [skip ci] Updated translations via Crowdin Add Changelog v1.16.7 (go-gitea#19575) (go-gitea#19644) Set safe dir for git operations in .drone.yml CI (go-gitea#19641) Add missing `sorting` column in `project_issue` table (go-gitea#19635)
To fixes these longstanding bugs: Fix PR diff review form submit #32596 |
Screenshots
See the counter of pending comments:
Animation of pulse:
https://user-images.githubusercontent.com/25481501/166842189-73785fef-d3ac-45a5-8bd9-bec02a008aea.mp4