Comments on dynamically added content do not work #14112

Closed
opened 2025-11-02 11:03:15 -06:00 by GiteaMirror · 3 comments
Owner

Originally created by @McRaeAlex on GitHub (Feb 7, 2025).

Originally assigned to: @McRaeAlex on GitHub.

Description

When content is dynamically added to the page and comments that are part of the dynamically added content do not have "full" behaviour.

For example when viewing a pull request which doesn't have all the files loaded (exceeds git.MAX_GIT_DIFF_FILES) then a "Show More" button appears at the bottom of the page. When the new file diffs are loaded they include their comments however the user isn't able to edit them.

To reproduce I suggest creating a design review with 2 files, adding a comment on the second and then setting git.MAX_GIT_DIFF_FILES=1 and reloading. This will force you to click "show more" and observe the behaviour when trying to edit the comment.

Problem

The event listener isn't being attached to the DOM for the the button. The eventHandler can be found at semantic.js:2391 (of the build output). I am working on figuring out where the event listener should be added but any help would be apprieciated.

Screenshots

Button thats not working

Image

Screen Recording

https://github.com/user-attachments/assets/f71e5275-7fa1-46b0-9238-0ef20cc85d5d

Gitea Version

main, 1.23, 1.22

Can you reproduce the bug on the Gitea demo site?

Yes but due to git.MAX_GIT_DIFF_FILES being rather large its easier to do locally.

Operating System

No response

Browser Version

Chrome, Firefox latest

Originally created by @McRaeAlex on GitHub (Feb 7, 2025). Originally assigned to: @McRaeAlex on GitHub. ### Description When content is dynamically added to the page and comments that are part of the dynamically added content do not have "full" behaviour. For example when viewing a pull request which doesn't have all the files loaded (exceeds `git.MAX_GIT_DIFF_FILES`) then a "Show More" button appears at the bottom of the page. When the new file diffs are loaded they include their comments however the user isn't able to edit them. To reproduce I suggest creating a design review with 2 files, adding a comment on the second and then setting `git.MAX_GIT_DIFF_FILES=1` and reloading. This will force you to click "show more" and observe the behaviour when trying to edit the comment. ## Problem The event listener isn't being attached to the DOM for the the button. The eventHandler can be found at semantic.js:2391 (of the build output). I am working on figuring out where the event listener should be added but any help would be apprieciated. ### Screenshots Button thats not working <img width="867" alt="Image" src="https://github.com/user-attachments/assets/d1918e89-e233-4266-9c00-7b3bba8c5c5b" /> Screen Recording https://github.com/user-attachments/assets/f71e5275-7fa1-46b0-9238-0ef20cc85d5d ### Gitea Version main, 1.23, 1.22 ### Can you reproduce the bug on the Gitea demo site? Yes but due to `git.MAX_GIT_DIFF_FILES` being rather large its easier to do locally. ### Operating System _No response_ ### Browser Version Chrome, Firefox latest
GiteaMirror added the type/bugtopic/ui labels 2025-11-02 11:03:15 -06:00
Author
Owner

@McRaeAlex commented on GitHub (Feb 7, 2025):

I am working on this as it comes up for some customers. I will post any updates here. If anyone has insights please let me know.

@McRaeAlex commented on GitHub (Feb 7, 2025): I am working on this as it comes up for some customers. I will post any updates here. If anyone has insights please let me know.
Author
Owner

@McRaeAlex commented on GitHub (Feb 7, 2025):

After looking at this a bit, it seems this event listener is added in initGlobalDropdown which only runs once when the DOM is loaded.

Its unclear to if calling initGlobalDropdown again on every "Show More" is suitable. It seems like a heavy handed approach and may result in multiple event listeners.

I am looking for something similar to htmx.process but for the fomantic stuff.

@McRaeAlex commented on GitHub (Feb 7, 2025): After looking at this a bit, it seems this event listener is added in `initGlobalDropdown` which only runs once when the DOM is loaded. Its unclear to if calling `initGlobalDropdown` again on every "Show More" is suitable. It seems like a heavy handed approach and may result in multiple event listeners. I am looking for something similar to `htmx.process` but for the fomantic stuff.
Author
Owner

@wxiaoguang commented on GitHub (Mar 11, 2025):

Thank you for the report&investigation and the PR.

I think it could be closed (fixed by Fix dynamic content loading init problem #33748 )

@wxiaoguang commented on GitHub (Mar 11, 2025): Thank you for the report&investigation and the PR. I think it could be closed (fixed by Fix dynamic content loading init problem #33748 )
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#14112