-
-
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 show loading indicators when refreshing the system status #30712
Conversation
When I added this the dividers didn't render the loading indicators but I guess some CSS has changed since then. Now we render the loading indicators on hidden elements so they don't appear. Signed-off-by: Yarden Shoham <git@yardenshoham.com>
8694552
to
1f4ad26
Compare
Hmm,
What's the point of |
We want the indicator for other htmx-based requests such as subscribe and watch |
Yeah but can't we remove it from this one element? |
I didn't see any other option |
So the problem is htmx can not distinguish between initial and subsequent requests, e.g. you can't conditionally show |
templates/admin/dashboard.tmpl
Outdated
@@ -76,7 +76,7 @@ | |||
{{ctx.Locale.Tr "admin.dashboard.system_status"}} | |||
</h4> | |||
{{/* TODO: make these stats work in multi-server deployments, likely needs per-server stats in DB */}} | |||
<div hx-get="{{$.Link}}/system_status" hx-swap="morph:innerHTML" hx-trigger="every 5s" hx-indicator=".divider" class="ui attached table segment"> | |||
<div hx-get="{{$.Link}}/system_status" hx-swap="morph:innerHTML" hx-trigger="every 5s" hx-indicator=".tw-hidden" class="ui attached table segment"> |
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
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.
Actually it could also use something like hx-indicator="no-indicator"
, because no-indicator
also matches nothing.
Or even as simple as hx-indicator="no"
, we would never use <no>
tag in HTML code, so it also matches nothing.
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.
But that prints an error in the console on every request
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 see, then tw-hidden
also doesn't seem good enough because tw-hidden
might also not exist.
Ideally it could be like this:
<div hx-get="{{$.Link}}/system_status" hx-swap="morph:innerHTML" hx-trigger="every 5s" hx-indicator=".tw-hidden" class="ui attached table segment"> | |
<div hx-get="{{$.Link}}/system_status" hx-swap="morph:innerHTML" hx-trigger="every 5s" hx-indicator=".hidden-loading-indicator" class="ui attached table segment"> |
Then put <div class="hidden-loading-indicator tw-hidden"></div>
into "admin/system_status"
Then everything is clear and I think it reads better.
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.
And more details, .tw-hidden
can't be right. It just adds the indicator to all the tw-hidden
elements on this page, which causes various side effects
Think about a case:
<div class="panel tw-hidden"></div>
<div hx-get hx-indicator=".tw-hidden"></div>
The "panel" is not related to the hx-get.
When the loading-indicator is added to the "panel", and the request is still running, then the user shows the panel: surprise: they sees a "loading panel".
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: silverwind <me@silverwind.io>
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's a hack, but I guess a barely acceptable one. Would prefer a solution in htmx to suppress indicator on specific elements.
Will test it and then remove it. |
I do not see any reason to block merging this change. |
Fixed and tested. |
NOOOOOOOOOOOOOOOO! See the discussion above. |
Hmm it does seem htmx falls back to the element if nothing matches: So your fix is better. |
It doens't fallback, it only returns an empty array. But there will be a lot of error messages in user's console, it would confuse users and developers. The root problem is that htmx insists to find something to show the indicator. If htmx could change its behavior to avoiding showing the indicator, life will be easier. |
Anyways, I have to add a remark that I'm starting to despise htmx. It's clearly not a well thought-out framework. |
Right, querySelectorAll returns empty |
Upstream issue: bigskysoftware/htmx#2515 |
* giteaofficial/main: Make Ctrl+Enter work for issue/comment edit (go-gitea#30720) Rename migration package name for 1.22-rc1 (go-gitea#30730) Issue card improvements (go-gitea#30687) Don't show loading indicators when refreshing the system status (go-gitea#30712) Add some tests to clarify the "must-change-password" behavior (go-gitea#30693) Prevent allow/reject reviews on merged/closed PRs (go-gitea#30686) Update JS dependencies (go-gitea#30713) Improve diff stats bar (go-gitea#30669) Remove unused parameter for some functions in `services/mirror` (go-gitea#30724) Update misspell to 0.5.1 and add `misspellings.csv` (go-gitea#30573) Suppress browserslist warning in webpack target (go-gitea#30571) [skip ci] Updated translations via Crowdin Diff color enhancements, add line number background (go-gitea#30670)
* origin/main: Replace deprecated `math/rand` functions (go-gitea#30733) Make Ctrl+Enter work for issue/comment edit (go-gitea#30720) Rename migration package name for 1.22-rc1 (go-gitea#30730) Issue card improvements (go-gitea#30687) Don't show loading indicators when refreshing the system status (go-gitea#30712) Add some tests to clarify the "must-change-password" behavior (go-gitea#30693) Prevent allow/reject reviews on merged/closed PRs (go-gitea#30686) Update JS dependencies (go-gitea#30713) Improve diff stats bar (go-gitea#30669) Remove unused parameter for some functions in `services/mirror` (go-gitea#30724) Update misspell to 0.5.1 and add `misspellings.csv` (go-gitea#30573) Suppress browserslist warning in webpack target (go-gitea#30571) [skip ci] Updated translations via Crowdin Diff color enhancements, add line number background (go-gitea#30670) feat(api): enhance Actions Secrets Management API for repository (go-gitea#30656) Fix code search input for different views (go-gitea#30678) Fix incorrect object id hash function (go-gitea#30708)
Regression with double border: #31363 |
Fix regression from #30712 where the introduction of this `<div>` caused the `.ui.attached:not(.message) + .ui.attached.segment:not(.top)` CSS selector to no longer work and cause a double border. Before: <img width="200" alt="Screenshot 2024-06-13 at 19 06 12" src="https://github.com/go-gitea/gitea/assets/115237/a9fa0688-adf0-4b2d-a958-6a7679a62031"> After: <img width="232" alt="Screenshot 2024-06-13 at 19 05 57" src="https://github.com/go-gitea/gitea/assets/115237/025b780f-f72f-4049-86de-a5d84851bd1d"> --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Fix regression from go-gitea#30712 where the introduction of this `<div>` caused the `.ui.attached:not(.message) + .ui.attached.segment:not(.top)` CSS selector to no longer work and cause a double border. Before: <img width="200" alt="Screenshot 2024-06-13 at 19 06 12" src="https://github.com/go-gitea/gitea/assets/115237/a9fa0688-adf0-4b2d-a958-6a7679a62031"> After: <img width="232" alt="Screenshot 2024-06-13 at 19 05 57" src="https://github.com/go-gitea/gitea/assets/115237/025b780f-f72f-4049-86de-a5d84851bd1d"> --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
When I added this the dividers didn't render the loading indicators but I guess some CSS has changed since then. Now we render the loading indicator on a hidden element so it won't appear.
Before
After