-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Provide an option to suppress hx-indicator
#2515
Comments
Agree, this is important for pages which need to refresh flawlessly (without showing any loading indicator when reloading). At the moment, htmx insists to find something to add the loading indicator:
|
Hey, I'm not sure I fully understand the issue, could you maybe provide a code example of your situation? |
What do you think about the case in #2515 (comment) ? We have this:
The purpose is to make the page refresh every 5 seconds. We need to make the page reload without the indicator, to make it flawless (no flickering) to end users. |
Oh ok so to make sure I understand; a parent element with a huge child content that itself may contain indicators at various places, thus when the parent element gets the htmx-request class added, it makes all the child indicators visible ? If that's the case, as a way to work around it for now, you may define this page-refreshing <div id="pageContent">
a lot of elements ...
</div>
<div hx-get="..." hx-trigger="every 5s" hx-target="#pageContent"></div> Or as a child, would also work <div>
<div hx-get="..." hx-trigger="every 5s" hx-target="closest div"></div>
a lot of elements ...
</div> This way, the htmx-request isn't added to the top element anymore, but on that dummy element that doesn't have any child anyway ; the behavior is still the same, and you don't need to add any extra CSS to do the suppression that the OP mentioned |
Thank you, it seems to be a feasible approach, but using an extra/empty element seems counter-intuitive ..... |
Totally understandle, it's a bit of a "hack" given your situation indeed. |
I have the same use-case as @wxiaoguang, and I think having hx-indicator="none" would make sense, but I tend to always set my hx-indicator explicitely anyway. Actually for me the default behavior ("this", more or less) is not an ideal choice... Anyway, I'm going with the workaround as mentioned, but I prefer to let the logic stay on the actual element, and have an additional element just eat the <div hx-get="..." hx-trigger="every 5s" hx-indicator="find .htmx-indicator-sink">
<div class="htmx-indicator-sink"></div>
<!--a lot of elements here...-->
</div> |
Came across this issue where a parent form has a hx-indicator to show a spinner when the form is submitted, however the form input fields had inline validation on change. This caused the form to refresh on each key stroke |
hx-indicator currently provides no way to suppress it for specific elements, e.g. to achieve showing a loading indicator by default, but don't show it for specific elements.
It would be nice if
hx-indicator="none"
or similar would be supported to not add thehtmx-request
class to a specific element. I think this is a better solution than to force the user to do the suppression via CSS, which is currently the only option.The text was updated successfully, but these errors were encountered: