Refactor htmx and fetch-action related code#37186
Open
wxiaoguang wants to merge 1 commit intogo-gitea:mainfrom
Open
Refactor htmx and fetch-action related code#37186wxiaoguang wants to merge 1 commit intogo-gitea:mainfrom
wxiaoguang wants to merge 1 commit intogo-gitea:mainfrom
Conversation
Contributor
Author
a82b0cf to
ea41d60
Compare
Closed
b7bf493 to
4001304
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR is an initial refactor step to replace several htmx-driven interactions with the existing fetch-action mechanism plus a lightweight “fetch sync” DOM update path (including optional Idiomorph morphing), preparing for later removal of htmx.
Changes:
- Reworked
common-fetch-actionto support sync HTML responses (data-fetch-sync) and periodic/auto triggers (data-fetch-trigger). - Updated templates to use
data-fetch-*attributes for watch/unwatch, star/unstar, repo file list last-commit lazy loading, and admin system status refresh. - Removed the htmx morph extension wiring and added direct Idiomorph usage/type declarations.
Reviewed changes
Copilot reviewed 16 out of 17 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| web_src/js/globals.ts | Stops loading the htmx Idiomorph extension globally. |
| web_src/js/features/common-fetch-action.ts | Core refactor: adds sync DOM update path, triggers, and Idiomorph integration. |
| web_src/css/repo/home-file-list.css | Tweaks loading indicator styling for file list cells. |
| types.d.ts | Adds a local module declaration for idiomorph. |
| templates/repo/watch_unwatch.tmpl | Switches watch/unwatch to link-action + fetch sync update. |
| templates/repo/star_unstar.tmpl | Switches star/unstar to link-action + fetch sync update. |
| templates/repo/view_list.tmpl | Replaces htmx last-commit lazy loading with fetch-trigger + Idiomorph sync. |
| templates/repo/user_cards.tmpl | Replaces htmx refresh trigger with fetch-reload marker for post-sync refresh. |
| templates/projects/view.tmpl | Renames method attribute to data-fetch-action-method. |
| templates/base/head.tmpl | Removes hx-ext="morph" from <body>. |
| templates/admin/system_status.tmpl | Converts system status refresh to periodic fetch trigger + Idiomorph sync. |
| templates/admin/dashboard.tmpl | Removes wrapper htmx refresh container; uses system_status template directly. |
| routers/web/web.go | Changes /lastcommit/* route from POST to GET. |
| routers/web/repo/watch.go | Removes HX-Trigger response header usage. |
| routers/web/repo/star.go | Removes HX-Trigger response header usage. |
| routers/web/repo/view.go | Adjusts debug helper for clearing commit info (now only clears half). |
| eslint.config.ts | Removes restricted-import entry for idiomorph/htmx since it’s no longer globally loaded. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
4001304 to
3b4bcba
Compare
3b4bcba to
3957550
Compare
3957550 to
d20e2d3
Compare
d20e2d3 to
6e62cf8
Compare
6e62cf8 to
1adeebb
Compare
1adeebb to
b85bc2d
Compare
1c3a37a to
070c065
Compare
070c065 to
563d17f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.




This is the first step (the hardest part). I have tested:
The legacy "data-redirect" attribute is removed, it only makes the page reload (sometimes using an incorrect link).
Also did cleanup for some devtest pages.
Next PR will completely remove htmx without introducing so many JS code changes.