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

Some commits are shown as ... in file list with js error: JavaScript error: Uncaught TypeError: Cannot read properties of undefined (reading 'replaceWith') #19995

Closed
Fogapod opened this issue Jun 17, 2022 · 9 comments · Fixed by #19996
Labels
issue/confirmed Issue has been reviewed and confirmed to be present or accepted to be implemented topic/ui Change the appearance of the Gitea UI type/bug
Milestone

Comments

@Fogapod
Copy link
Contributor

Fogapod commented Jun 17, 2022

Description

https://gitea.com/marktsai0316/linux/src/branch/master/scripts
https://gitea.com/marktsai0316/linux/src/branch/master/scripts/clang-tools
https://gitea.com/marktsai0316/linux/src/branch/master/scripts/atomic

Error from ui: JavaScript error: Uncaught TypeError: Cannot read properties of undefined (reading 'replaceWith') (https://gitea.com/assets/js/index.js?v=5b550aecacf32806c61a3f6e9820c873 @ 83:2368). Open browser console to see more details.
From console:

Uncaught TypeError: Cannot read properties of undefined (reading 'replaceWith')
    at HTMLTableRowElement.<anonymous> (index.js?v=5b550aecacf32806c61a3f6e9820c873:83:2368)
    at Function.each (index.js?v=5b550aecacf32806c61a3f6e9820c873:1:5483)
    at s.fn.init.each (index.js?v=5b550aecacf32806c61a3f6e9820c873:1:3942)
    at Object.success (index.js?v=5b550aecacf32806c61a3f6e9820c873:83:2229)
    at Ce (index.js?v=5b550aecacf32806c61a3f6e9820c873:1:32645)
    at Object.fireWith [as resolveWith] (index.js?v=5b550aecacf32806c61a3f6e9820c873:1:33444)
    at Xi (index.js?v=5b550aecacf32806c61a3f6e9820c873:4:6109)
    at XMLHttpRequest.<anonymous> (index.js?v=5b550aecacf32806c61a3f6e9820c873:4:8596)

When this happens, some files dont show commit message/date:
image

I am not sure how to reproduce this reliably yet. It just happens randomly with random files when going through folders
image

Error goes away after a few page refreshes. I noticed that it happens more frequently with small browser window

Screenshots

image

Gitea Version

1.17.0+dev-711-g1fef9a2d6

Can you reproduce the bug on the Gitea demo site?

Yes

Operating System

Artix Linux

Browser Version

Chromium based 100+

@Fogapod Fogapod added type/bug topic/ui Change the appearance of the Gitea UI labels Jun 17, 2022
@lunny
Copy link
Member

lunny commented Jun 17, 2022

Cannot reproduce it in macOS 12.4 with Chrome 97.0

@Fogapod
Copy link
Contributor Author

Fogapod commented Jun 17, 2022

image

I just reproduced this with librewolf 101.0.1 (firefox based), so this doesn't seem browser related.

I suggest going through different folders because it seems like this error goes away for some time after you open these folders. Probably caching related somehow.

EDIT: just noticed that there is a different error now but the result is similar. Error text: JavaScript error: TypeError: e[r(...).attr(...)] is undefined (https://gitea.com/assets/js/index.js?v=5b550aecacf32806c61a3f6e9820c873 @ 83:2344). Open browser console to see more details.

Console:

Uncaught TypeError: e[r(...).attr(...)] is undefined
    mb https://gitea.com/assets/js/index.js?v=5b550aecacf32806c61a3f6e9820c873:83
    each https://gitea.com/assets/js/index.js?v=5b550aecacf32806c61a3f6e9820c873:1
    each https://gitea.com/assets/js/index.js?v=5b550aecacf32806c61a3f6e9820c873:1
    mb https://gitea.com/assets/js/index.js?v=5b550aecacf32806c61a3f6e9820c873:83
    Ce https://gitea.com/assets/js/index.js?v=5b550aecacf32806c61a3f6e9820c873:1
    fireWith https://gitea.com/assets/js/index.js?v=5b550aecacf32806c61a3f6e9820c873:1
    Xi https://gitea.com/assets/js/index.js?v=5b550aecacf32806c61a3f6e9820c873:4
    u https://gitea.com/assets/js/index.js?v=5b550aecacf32806c61a3f6e9820c873:4
[index.js:83:2344](https://gitea.com/assets/js/index.js?v=5b550aecacf32806c61a3f6e9820c873)
    mb https://gitea.com/assets/js/index.js?v=5b550aecacf32806c61a3f6e9820c873:83
    each https://gitea.com/assets/js/index.js?v=5b550aecacf32806c61a3f6e9820c873:1
    each https://gitea.com/assets/js/index.js?v=5b550aecacf32806c61a3f6e9820c873:1
    mb https://gitea.com/assets/js/index.js?v=5b550aecacf32806c61a3f6e9820c873:83
    Ce https://gitea.com/assets/js/index.js?v=5b550aecacf32806c61a3f6e9820c873:1
    fireWith https://gitea.com/assets/js/index.js?v=5b550aecacf32806c61a3f6e9820c873:1
    Xi https://gitea.com/assets/js/index.js?v=5b550aecacf32806c61a3f6e9820c873:4
    u https://gitea.com/assets/js/index.js?v=5b550aecacf32806c61a3f6e9820c873:4

@wxiaoguang
Copy link
Contributor

index.js: {r("table#repo-files-table .commit-list").replaceWith(l);return}e[r(l).attr("data-entryname")].replaceWith(l)})

Crashed here:

entryMap[$(row).attr('data-entryname')].replaceWith(row);

@wxiaoguang wxiaoguang added the issue/confirmed Issue has been reviewed and confirmed to be present or accepted to be implemented label Jun 17, 2022
@wxiaoguang wxiaoguang added this to the 1.17.0 milestone Jun 17, 2022
@wxiaoguang
Copy link
Contributor

A quick patch: #19996

I do not know how it happens at the moment, the logic seems complex here. 😂

@wxiaoguang
Copy link
Contributor

@Fogapod that's very strange that I still have difficult to reproduce the problem. So here is a quick patch.

Could you find more clues about how to trigger the error? It seems that the returned content is the key. Could you share the returned lastcommit response when error occurs? Thank you very much.

@Fogapod
Copy link
Contributor Author

Fogapod commented Jun 17, 2022

What do you mean by lastcommit?
I have https://gitea.com/marktsai0316/linux/src/branch/master/drivers opened right now and more than half of files are shown as ....
These are all requests i have:
image

@wxiaoguang
Copy link
Contributor

Hmm .... I think I have some clues about the problem .....

@Fogapod
Copy link
Contributor Author

Fogapod commented Jun 17, 2022

In case this is somehow useful: red box is properly displayed commit, blue is .... Css classes are different for them. I don't know what this might mean though:

image

@wxiaoguang
Copy link
Contributor

OK, everything clear. Will update the PR soon.

The problem is that there are unrecognized tr rows in response, and the JS code didn't handle it correctly.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
issue/confirmed Issue has been reviewed and confirmed to be present or accepted to be implemented topic/ui Change the appearance of the Gitea UI type/bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants