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

Debounced issue suggestion request makes text-expander report JS promise error #33388

Closed
stuzer05 opened this issue Jan 25, 2025 · 7 comments · Fixed by #33389
Closed

Debounced issue suggestion request makes text-expander report JS promise error #33388

stuzer05 opened this issue Jan 25, 2025 · 7 comments · Fixed by #33389
Labels
Milestone

Comments

@stuzer05
Copy link
Contributor

stuzer05 commented Jan 25, 2025

Description

Steps:

  • open new issue editor (or PR)
Closes #445
Closes #446
  • then slowly press backspace until you remove #
    Image
  • see error
Uncaught (in promise) DOMException: Index or size is negative or greater than the allowed amount
    $l index.js:431
    getBoundingClientRect index.js:393
    positionMenu index.js:490
    activate index.js:483
    onInput index.js:575

Gitea Version

1.24.0+dev-218-g7da8a01d39

Can you reproduce the bug on the Gitea demo site?

Yes

Log Gist

No response

Screenshots

No response

Git Version

No response

Operating System

No response

How are you running Gitea?

docker

Database

None

@wxiaoguang
Copy link
Contributor

It seems to be related to the text-expander popup and the debounced suggestion network request. But I am still unable to reproduce it on my side ... will try to figure out.

If anyone has ideas, also thank you very much for the help.

@wxiaoguang
Copy link
Contributor

Tried many many times, then caught a new error:

index.js:431 Uncaught (in promise) IndexSizeError: Failed to execute 'setStart' on 'Range': The offset 28 is larger than the node's length (27).
    at #createCloneRange (index.js:431:1)
    at InputRange.getBoundingClientRect (index.js:393:1)
    at TextExpander.positionMenu (index.js:490:1)
    at TextExpander.activate (index.js:483:1)
    at TextExpander.onInput (index.js:575:1)

@stuzer05
Copy link
Contributor Author

It seems to be related to the text-expander popup and the debounced suggestion network request. But I am still unable to reproduce it on my side ... will try to figure out.

If anyone has ideas, also thank you very much for the help.

Try putting real issue id on your side and then copy-paste those lines into new editor instance

@wxiaoguang
Copy link
Contributor

wxiaoguang commented Jan 25, 2025

Try putting real issue id on your side and then copy-paste those lines into new editor instance

Yep, I have tried, but still very difficult to reproduce. I tried to add a Sleep in the IssueSuggestions, maybe it could make it easier to reproduce.


I think the problem overall is like this:

  • The issue suggestion request is debounced
  • When the request finishes but the textarea has changed, it causes errors in text-expander

@wxiaoguang wxiaoguang changed the title Js error editing linked issue in issue text editor Debounced issue suggestion request makes text-expander report JS promise error Jan 25, 2025
@stuzer05
Copy link
Contributor Author

I think the problem overall is like this:

* The issue suggestion request is debounced

* When the request finishes but the textarea has changed, it causes errors in text-expander

Logically looks a lot like it

@wxiaoguang
Copy link
Contributor

Hmm, it looks like related to "multiword", but not the debounce ......... really strange.

@wxiaoguang
Copy link
Contributor

It's impossible to completely fix the bug, as a workaround, I think we can do this: Fix issue suggestion bug #33389

@lunny lunny added this to the 1.23.2 milestone Jan 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants