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

Fix repo graph JS #31377

Merged
merged 1 commit into from
Jun 14, 2024
Merged

Conversation

wxiaoguang
Copy link
Contributor

Fix #31376
Regression of #30395

@pull-request-size pull-request-size bot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Jun 14, 2024
@GiteaBot GiteaBot added this to the 1.22.1 milestone Jun 14, 2024
@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Jun 14, 2024
@wxiaoguang wxiaoguang added type/bug and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Jun 14, 2024
@wxiaoguang wxiaoguang changed the title fix Fix repo graph JS Jun 14, 2024
@pull-request-size pull-request-size bot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Jun 14, 2024
@wxiaoguang wxiaoguang linked an issue Jun 14, 2024 that may be closed by this pull request
@GiteaBot GiteaBot added the lgtm/need 1 This PR needs approval from one additional maintainer to be merged. label Jun 14, 2024
@lunny
Copy link
Member

lunny commented Jun 14, 2024

So the bug has been fixed in v1.23?

@wxiaoguang
Copy link
Contributor Author

So the bug has been fixed in v1.23?

We do not use getElementById in 1.23

@silverwind
Copy link
Member

Note that this is div.getElementById, which was invalid of course. This is something typescript would have detected.

@silverwind
Copy link
Member

silverwind commented Jun 14, 2024

The bug was actually fixed as a side-effect during the refactor:

507fbf4#diff-b1b78ba5dc4cc4c29c14bdb3285dcb7e2893f4afd4904659c6afdad99a49b917R72-R74

Strictly speaking, this is actually a bug in the eslint rule that it even touched this, but as I don't see any negatives in that fix, I'm not even going to report it.

@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Jun 14, 2024
@silverwind silverwind merged commit 188e515 into go-gitea:release/v1.22 Jun 14, 2024
26 checks passed
@wxiaoguang wxiaoguang deleted the fix-repo-graph branch June 14, 2024 16:57
@wxiaoguang
Copy link
Contributor Author

wxiaoguang commented Jun 14, 2024

This is something typescript would have detected.

Unless everyone agrees to rewrite the legacy code carefully and fully test the newly-written code. Otherwise, blindly replacing old code won't work with typescript.

@silverwind
Copy link
Member

silverwind commented Jun 14, 2024

Typescript addition is not a rewrite. It's more of an enhancement of existing code. Adding type signatures to functions already gets you 90% to type safety because the type inferrence is very good.

@wxiaoguang
Copy link
Contributor Author

Most bugs are caused by refactoring & rewriting & accessing HTML data/HTTP response. I do not see how typescript would really help daily development at the moment if it doesn't help the refactoring&rewriting work. So at the moment I am not sure whether it is the right time to introduce it. That's just my opinion, I don't understand and I won't block.

@wxiaoguang
Copy link
Contributor Author

My suggestion is: if a new approach would be introduced, then start it from the hardest part, for example: rewrite repo-legacy or something similar to make sure the new approach really works as expected.

@silverwind
Copy link
Member

silverwind commented Jun 17, 2024

If I refactor a part of the code, I would definitely want the new parts to be typesafe so it would definitely help in combing the work of type safety and general refactoring which both can be done in one go.

I have been writing a lot of typescript lately, and I find it a bit scary to touch a JS codebase given the lack of "safety nets" provided by typescript.

@go-gitea go-gitea locked as resolved and limited conversation to collaborators Sep 14, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. modifies/js size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. type/bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Promise rejection when filtering branch in commit graph
4 participants