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

Closed
opened 2025-11-02 11:01:11 -06:00 by GiteaMirror · 7 comments
Owner

Originally created by @stuzer05 on GitHub (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

Originally created by @stuzer05 on GitHub (Jan 25, 2025). ### Description Steps: - open new issue editor (or PR) ``` Closes #445 Closes #446 ``` - then slowly press backspace until you remove `#` ![Image](https://github.com/user-attachments/assets/e14410bd-7f20-46fd-ba40-db0845d7255f) - 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
GiteaMirror added the type/bug label 2025-11-02 11:01:11 -06:00
Author
Owner

@wxiaoguang commented on GitHub (Jan 25, 2025):

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 commented on GitHub (Jan 25, 2025): 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.
Author
Owner

@wxiaoguang commented on GitHub (Jan 25, 2025):

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)
@wxiaoguang commented on GitHub (Jan 25, 2025): 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) ```
Author
Owner

@stuzer05 commented on GitHub (Jan 25, 2025):

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

@stuzer05 commented on GitHub (Jan 25, 2025): > 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
Author
Owner

@wxiaoguang commented on GitHub (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 commented on GitHub (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
Author
Owner

@stuzer05 commented on GitHub (Jan 25, 2025):

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

@stuzer05 commented on GitHub (Jan 25, 2025): > 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
Author
Owner

@wxiaoguang commented on GitHub (Jan 25, 2025):

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

@wxiaoguang commented on GitHub (Jan 25, 2025): Hmm, it looks like related to "multiword", but not the debounce ......... really strange.
Author
Owner

@wxiaoguang commented on GitHub (Jan 25, 2025):

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

@wxiaoguang commented on GitHub (Jan 25, 2025): It's impossible to completely fix the bug, as a workaround, I think we can do this: Fix issue suggestion bug #33389
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#14045