-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Don't do a full page load when clicking the subscribe button #28871
Conversation
- Refactor the form around the subscribe button into its own template - Use htmx to perform the form submission - `hx-boost="true"` to prevent the default form submission behavior of a full page load - `hx-sync="this:replace"` to replace the current request (in case the button is clicked again before the response is returned) - `hx-target="this"` to replace the form tag with the new form tag - `hx-push-url="false"` to disable a change to the URL - `hx-swap="show:no-scroll"` to preserve the scroll position - Change the backend response to return a `<form>` tag instead of a redirect to the issue page - Include `htmx.org` in javascript imports This change introduces htmx with the hope we could use it to make Gitea more reactive while keeping our "HTML rendered on the server" approach. Signed-off-by: Yarden Shoham <git@yardenshoham.com>
864cc22
to
5202c57
Compare
From CI: |
According to my quick search, BSD2 is compatible with MIT, so it should be possible. |
I think we need enough disscuss before introducing htmx. Maybe a new issue with proposql is better. |
I asked in discord and there was no negative response. We can discuss on this PR |
Signed-off-by: Yarden Shoham <git@yardenshoham.com>
I think we have ever discussed htmx here #5937 |
I'm in favour of introducing HTMX, as in this case it allows for more elegant and functional UI without having to rebuild everything to a JS framework and without adding much overhead |
So then we will mix the framework include vue3+jquery+htmx+go template on the same repository? |
I think if I was using vue3 or jquery for this PR it would add more lines of code than using htmx |
HTMX looks promising! |
Wasn't that maybe a bit too fast? If there are objections against using HTMX, we should discuss them..... |
Didn't you lgtm ?!? |
I fully support this change, and it's also true that two lgtms are enough to merge a PR according to our guidelines. I'm just in favour of discussing all objections before merging :) |
Ah ok next time just reject and ask for it first 😆 Anyway atm I'm still a TOC member (till we get the vote results...) that did accept it ... so should be fine ;) But i can bring it up to discust to the whole TOC if you'd like to. |
As I said, I fully support this change. We finally need a thought-out decision-making process for such things, but we don't have one yet to I guess it it is fine 😆 |
You can also count in a tentative approval from me. |
@6543 You should not merge it too fast since we have more maintainers ecspcially @wxiaoguang and @silverwind haven't introduce their reviews. After all, this is a new framework/js library. We should consider it carefully. |
I do not think the problem has been clearly defined or resolved. If htmx is introduced, now there are at least 3 frameworks in Gitea:
Is there a clear roadmap for how to refactor legacy code and introduce new changes? For example:
Then the question is: does htmx really help and will be widely used? I have been following htmx for some time. My feeling is:
So, IMO the only useful part of htmx at the moment is the "replacing inner html by ajax", while it is quite simple and could (should) be implemented by existing "link-action" and "form-fetch-action". Other htmx features are unlikely useful in foreseeable future |
the consensis was that we do want to get rid of jQuery or has this changed? |
I have asked many times: if new PRs come with jQuery, what should be done? Ask (force) the contributors to rewrite the code? Maintainer help to rewrite the code? If few people would really like to spend time on rewriting legacy code and rewriting jQuery PRs code, how would the "get rid of jQuery" plan succeed? More thoughts are here: #5937 (comment) And jQuery is somewhat off-topic here. The key question is: "Then the question is: does htmx really help and will be widely used?" |
I agree "Ask (force) the contributors to rewrite the code" |
…o-gitea#28871)" This reverts commit 14f6fcf.
well we should not talk at closed/merged issues/pulls so i created #28880 |
Hmm, I think it's necessary to do a full page load when clicking the subscribe button because It can help users to get the new comments on time. |
no that's not the point at all ?!? if we want to see "live" updates on comments that's a totali different issue and we do have to have either a smal background loop checking if there is something new and then update the html (proper way) or reload the page (non proper way). |
* giteaofficial/main: [skip ci] Updated licenses and gitignores Prevent anonymous container access if `RequireSignInView` is enabled (go-gitea#28877) Don't show new pr button when page is not compare pull (go-gitea#26431) Avoid duplicate JS error messages on UI (go-gitea#28873) Fix branch list bug which displayed default branch twice (go-gitea#28878) Revert adding htmx until we finaly decide to add it (go-gitea#28879) Don't do a full page load when clicking the follow button (go-gitea#28872) Don't do a full page load when clicking the subscribe button (go-gitea#28871) Fix incorrect PostgreSQL connection string for Unix sockets (go-gitea#28865) Run `npm audit fix` (go-gitea#28866) Fix migrate storage bug (go-gitea#28830) Set the `isPermaLink` attribute to `false` in the `guid` sub-element (go-gitea#28860) In administration documentation about environment variables, point to those for the Go runtime instead of Go compiler (go-gitea#28859) Move doctor package from modules to services (go-gitea#28856) Add support for sha256 repositories (go-gitea#23894) Fix incorrect action duration time when rerun the job before executed once (go-gitea#28364) Fix some RPM registry flaws (go-gitea#28782) tests: missing refs/ in bare repositories (go-gitea#28844) Fix archive creating LFS hooks and breaking pull requests (go-gitea#28848)
…a#28871) - Refactor the form around the subscribe button into its own template - Use htmx to perform the form submission - `hx-boost="true"` to prevent the default form submission behavior of a full page load - `hx-sync="this:replace"` to replace the current request (in case the button is clicked again before the response is returned) - `hx-target="this"` to replace the form tag with the new form tag - `hx-push-url="false"` to disable a change to the URL - `hx-swap="show:no-scroll"` to preserve the scroll position - Change the backend response to return a `<form>` tag instead of a redirect to the issue page - Include `htmx.org` in javascript imports This change introduces htmx with the hope we could use it to make Gitea more reactive while keeping our "HTML rendered on the server" approach. # Before ![before](https://github.com/go-gitea/gitea/assets/20454870/4ec3e81e-4dbf-4338-9968-b0655c276d4c) # After ![after](https://github.com/go-gitea/gitea/assets/20454870/8c8841af-9bfe-40b2-b1cd-cd1f3c90ba4d) --------- Signed-off-by: Yarden Shoham <git@yardenshoham.com>
…a#28871) - Refactor the form around the subscribe button into its own template - Use htmx to perform the form submission - `hx-boost="true"` to prevent the default form submission behavior of a full page load - `hx-sync="this:replace"` to replace the current request (in case the button is clicked again before the response is returned) - `hx-target="this"` to replace the form tag with the new form tag - `hx-push-url="false"` to disable a change to the URL - `hx-swap="show:no-scroll"` to preserve the scroll position - Change the backend response to return a `<form>` tag instead of a redirect to the issue page - Include `htmx.org` in javascript imports This change introduces htmx with the hope we could use it to make Gitea more reactive while keeping our "HTML rendered on the server" approach. # Before ![before](https://github.com/go-gitea/gitea/assets/20454870/4ec3e81e-4dbf-4338-9968-b0655c276d4c) # After ![after](https://github.com/go-gitea/gitea/assets/20454870/8c8841af-9bfe-40b2-b1cd-cd1f3c90ba4d) --------- Signed-off-by: Yarden Shoham <git@yardenshoham.com>
hx-boost="true"
to prevent the default form submission behavior of a full page loadhx-sync="this:replace"
to replace the current request (in case the button is clicked again before the response is returned)hx-target="this"
to replace the form tag with the new form taghx-push-url="false"
to disable a change to the URLhx-swap="show:no-scroll"
to preserve the scroll position<form>
tag instead of a redirect to the issue pagehtmx.org
in javascript importsThis change introduces htmx with the hope we could use it to make Gitea more reactive while keeping our "HTML rendered on the server" approach.
Before
After