-
-
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
Update the list of watchers and stargazers when clicking watch/unwatch or star/unstar #32570
Conversation
…h or star/unstar We make sure the user cards are updated Signed-off-by: Yarden Shoham <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would still strongly prefer to reload the whole page, instead of adding more special code (and the new code has no test code / is hard to test)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if we should mix HTMX terminology directly into Gitea:
It looks like the /cards
routes always (re-)render a list of users.
To me as a reader of the code, the /cards
prefix reads strange.
I can understand it in this PR as it is HTMX focused, but the moment it is merged you won't have that context anymore.
So, perhaps we can find another name for it.
But functionality-wise LGTM.
What happens to any potential JS event handlers in the swapped HTML when HTMX does the swap? How do we make sure that event handlers that need to be added to new cards are bound correctly after the swap? Likely there are currently no such event handlers, but it is something that must be considered when doing such swaps. |
This is true for any HTMX swap. This pull request is not the first one. There are no event handlers attached to the cards so we should be ok. |
templates/repo/watchers.tmpl
Outdated
hx-trigger="refreshCards from:body" | ||
hx-indicator=".no-loading-indicator" | ||
hx-swap="innerHTML" | ||
hx-get="{{$.Link}}/cards" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems that it could use hx-select to partially reloading, then no need to add these /cards
endpoints.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i will try it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just pushed 🤣
Managed to get it work in da86679, only a few changed lines now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One more thing, it should use CurrentURL
but not Link
, because there could be "page" query parameters.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah that looks great and the diff is smaller, thank you.
Co-authored-by: silverwind <[email protected]>
I was unable to create a backport for 1.22. @yardenshoham, please send one manually. 🍵
|
* giteaofficial/main: Support optional/configurable IAMEndpoint for Minio Client (go-gitea#32581) (go-gitea#32581) Update the list of watchers and stargazers when clicking watch/unwatch or star/unstar (go-gitea#32570) Apply to became a maintainer (go-gitea#32614)
We make sure the user cards are updated
I also removed
ctx.Data["PageIsWatchers"] = true
andctx.Data["PageIsStargazers"] = true
as they are not used anywhere.Before
After